Modify wildcard state of tokens in lexer

This commit is contained in:
Ibrahim Wassouf
2023-07-04 20:44:22 -03:00
parent 451b6b687e
commit 49747b314d

View File

@@ -72,14 +72,14 @@ accDescr\s*"{"\s* { this.begin("acc_descr_multili
<class-body>[\n] /* nothing */ <class-body>[\n] /* nothing */
<class-body>[^{}\n]* { return "MEMBER";} <class-body>[^{}\n]* { return "MEMBER";}
<*>"cssClass" return 'CSSCLASS'; <INITIAL>"cssClass" return 'CSSCLASS';
<*>"callback" return 'CALLBACK'; <INITIAL>"callback" return 'CALLBACK';
<*>"link" return 'LINK'; <INITIAL>"link" return 'LINK';
<*>"click" return 'CLICK'; <INITIAL>"click" return 'CLICK';
<*>"note for" return 'NOTE_FOR'; <INITIAL>"note for" return 'NOTE_FOR';
<*>"note" return 'NOTE'; <INITIAL>"note" return 'NOTE';
<*>"<<" return 'ANNOTATION_START'; <INITIAL>"<<" return 'ANNOTATION_START';
<*>">>" return 'ANNOTATION_END'; <INITIAL>">>" return 'ANNOTATION_END';
/* /*
---interactivity command--- ---interactivity command---
@@ -87,7 +87,7 @@ accDescr\s*"{"\s* { this.begin("acc_descr_multili
line was introduced with 'click'. line was introduced with 'click'.
'href "<link>"' attaches the specified link to the node that was specified by 'click'. 'href "<link>"' attaches the specified link to the node that was specified by 'click'.
*/ */
<*>"href"[\s]+["] this.begin("href"); <INITIAL>"href"[\s]+["] this.begin("href");
<href>["] this.popState(); <href>["] this.popState();
<href>[^"]* return 'HREF'; <href>[^"]* return 'HREF';
@@ -99,7 +99,7 @@ the line was introduced with 'click'.
arguments to the node that was specified by 'click'. arguments to the node that was specified by 'click'.
Function arguments are optional: 'call <callback_name>()' simply executes 'callback_name' without any arguments. Function arguments are optional: 'call <callback_name>()' simply executes 'callback_name' without any arguments.
*/ */
<*>"call"[\s]+ this.begin("callback_name"); <INITIAL>"call"[\s]+ this.begin("callback_name");
<callback_name>\([\s]*\) this.popState(); <callback_name>\([\s]*\) this.popState();
<callback_name>\( this.popState(); this.begin("callback_args"); <callback_name>\( this.popState(); this.begin("callback_args");
<callback_name>[^(]* return 'CALLBACK_NAME'; <callback_name>[^(]* return 'CALLBACK_NAME';
@@ -108,7 +108,7 @@ Function arguments are optional: 'call <callback_name>()' simply executes 'callb
<generic>[~] this.popState(); <generic>[~] this.popState();
<generic>[^~]* return "GENERICTYPE"; <generic>[^~]* return "GENERICTYPE";
<*>[~] this.begin("generic"); <INITIAL,class>"~" this.begin("generic");
<string>["] this.popState(); <string>["] this.popState();
<string>[^"]* return "STR"; <string>[^"]* return "STR";
@@ -116,20 +116,20 @@ Function arguments are optional: 'call <callback_name>()' simply executes 'callb
<bqstring>[`] this.popState(); <bqstring>[`] this.popState();
<bqstring>[^`]+ return "BQUOTE_STR"; <bqstring>[^`]+ return "BQUOTE_STR";
<*>[`] this.begin("bqstring"); <INITIAL,class>[`] this.begin("bqstring");
<*>"_self" return 'LINK_TARGET'; <INITIAL>"_self" return 'LINK_TARGET';
<*>"_blank" return 'LINK_TARGET'; <INITIAL>"_blank" return 'LINK_TARGET';
<*>"_parent" return 'LINK_TARGET'; <INITIAL>"_parent" return 'LINK_TARGET';
<*>"_top" return 'LINK_TARGET'; <INITIAL>"_top" return 'LINK_TARGET';
<*>\s*\<\| return 'EXTENSION'; <INITIAL>\s*\<\| return 'EXTENSION';
<*>\s*\|\> return 'EXTENSION'; <INITIAL>\s*\|\> return 'EXTENSION';
<*>\s*\> return 'DEPENDENCY'; <INITIAL>\s*\> return 'DEPENDENCY';
<*>\s*\< return 'DEPENDENCY'; <INITIAL>\s*\< return 'DEPENDENCY';
<*>\s*\* return 'COMPOSITION'; <INITIAL>\s*\* return 'COMPOSITION';
<*>\s*o return 'AGGREGATION'; <INITIAL>\s*o return 'AGGREGATION';
<*>\s*\(\) return 'LOLLIPOP'; <INITIAL>\s*\(\) return 'LOLLIPOP';
<*>\-\- return 'LINE'; <*>\-\- return 'LINE';
<*>\.\. return 'DOTTED_LINE'; <*>\.\. return 'DOTTED_LINE';
<*>":"{1}[^:\n;]+ return 'LABEL'; <*>":"{1}[^:\n;]+ return 'LABEL';
@@ -285,8 +285,8 @@ className
: alphaNumToken { $$=$1; } : alphaNumToken { $$=$1; }
| classLiteralName { $$=$1; } | classLiteralName { $$=$1; }
| alphaNumToken className { $$=$1+$2; } | alphaNumToken className { $$=$1+$2; }
| alphaNumToken GENERICTYPE { $$=$1+'~'+$2+'~'; } | alphaNumToken GENERICTYPE { $$=$1+"~"+$2+"~"; }
| classLiteralName GENERICTYPE { $$=$1+'~'+$2+'~'; } | classLiteralName GENERICTYPE { $$=$1+"~"+$2+"~"; }
; ;
statement statement
@@ -321,7 +321,7 @@ classStatements
; ;
classStatement classStatement
: classIdentifier : classIdentifier
| classIdentifier STYLE_SEPARATOR alphaNumToken {yy.setCssClass($1, $3);} | classIdentifier STYLE_SEPARATOR alphaNumToken {yy.setCssClass($1, $3);}
| classIdentifier STRUCT_START members STRUCT_STOP {yy.addMembers($1,$3);} | classIdentifier STRUCT_START members STRUCT_STOP {yy.addMembers($1,$3);}
| classIdentifier STYLE_SEPARATOR alphaNumToken STRUCT_START members STRUCT_STOP {yy.setCssClass($1, $3);yy.addMembers($1,$5);} | classIdentifier STYLE_SEPARATOR alphaNumToken STRUCT_START members STRUCT_STOP {yy.setCssClass($1, $3);yy.addMembers($1,$5);}