Added <a href> and callback functionality to gantt diagrams

This commit is contained in:
abzicht
2019-03-07 22:00:02 +01:00
parent 7d3578b31a
commit e298351caa

View File

@@ -7,23 +7,38 @@
%options case-insensitive
%{
// Pre-lexer code can go here
%}
/* string is used to detect blocks that are surrounded by double quotes. */
/* copied from /src/diagrams/flowchart/parser/flow.jison */
%x string
/* a valid callback looks like this: callback(example_callback_arg) */
/* callback prefix: callback( */
/* callback suffix: ) */
%x callback
%x callbackname
%%
[\n]+ return 'NL';
\s+ /* skip whitespace */
\#[^\n]* /* skip comments */
\%%[^\n]* /* skip comments */
/* Strings are used to detect tooltips */
["] this.begin("string");
<string>["] this.popState();
<string>[^"]* return 'STR';
"call"\s this.begin("callbackname");
<callbackname>\( this.popState(); this.begin("callback");
<callbackname>[^(]+ return 'callbackname';
<callback>[)] this.popState();
<callback>[^)]* return 'callbackarguments';
"click" return 'click';
"gantt" return 'gantt';
"dateFormat"\s[^#\n;]+ return 'dateFormat';
"axisFormat"\s[^#\n;]+ return 'axisFormat';
\d\d\d\d"-"\d\d"-"\d\d return 'date';
"title"\s[^#\n;]+ return 'title';
"section"\s[^#:\n;]+ return 'section';
[^#:\n;]+ return 'taskTxt';
[^#:()\n;]+ return 'taskTxt';
":"[^#\n;]+ return 'taskData';
":" return ':';
<<EOF>> return 'EOF';
@@ -58,7 +73,13 @@ statement
| 'axisFormat' {yy.setAxisFormat($1.substr(11));$$=$1.substr(11);}
| title {yy.setTitle($1.substr(6));$$=$1.substr(6);}
| section {yy.addSection($1.substr(8));$$=$1.substr(8);}
| clickStatement
| taskTxt taskData {yy.addTask($1,$2);$$='task';}
;
clickStatement
: click callbackname callbackarguments {$$ = $1;yy.setClickEvent($2, $3);}
| click STR callbackname callbackarguments {$$ = $1;yy.setLink($2);yy.setClickEvent($3, $4);}
| click STR {$$ = $1;yy.setLink($2);}
;
%%