mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-23 01:09:42 +02:00
#1217 Better matchingof words beginning with as as matching token AS in stateDiagram's state definition.
This commit is contained in:
@@ -48,7 +48,7 @@
|
||||
<STATE>.*"[[fork]]" {this.popState();yytext=yytext.slice(0,-8).trim();/*console.warn('Fork Fork: ',yytext);*/return 'FORK';}
|
||||
<STATE>.*"[[join]]" {this.popState();yytext=yytext.slice(0,-8).trim();/*console.warn('Fork Join: ',yytext);*/return 'JOIN';}
|
||||
<STATE>["] this.begin("STATE_STRING");
|
||||
<STATE>"as"\s* {this.popState();this.pushState('STATE_ID');return "AS";}
|
||||
<STATE>\s*"as"\s+ {this.popState();this.pushState('STATE_ID');return "AS";}
|
||||
<STATE_ID>[^\n\{]* {this.popState();/* console.log('STATE_ID', yytext);*/return "ID";}
|
||||
<STATE_STRING>["] this.popState();
|
||||
<STATE_STRING>[^"]* { /*console.log('Long description:', yytext);*/return "STATE_DESCR";}
|
||||
|
@@ -53,6 +53,39 @@ describe('state diagram, ', function() {
|
||||
|
||||
parser.parse(str);
|
||||
});
|
||||
|
||||
it('handle "as" in state names', function() {
|
||||
const str = `stateDiagram
|
||||
assemble
|
||||
state assemble
|
||||
`;
|
||||
|
||||
parser.parse(str);
|
||||
});
|
||||
it('handle "as" in state names 1', function() {
|
||||
const str = `stateDiagram
|
||||
assemble
|
||||
state assemble
|
||||
`;
|
||||
|
||||
parser.parse(str);
|
||||
});
|
||||
it('handle "as" in state names 2', function() {
|
||||
const str = `stateDiagram
|
||||
assembleas
|
||||
state assembleas
|
||||
`;
|
||||
|
||||
parser.parse(str);
|
||||
});
|
||||
it('handle "as" in state names 3', function() {
|
||||
const str = `stateDiagram
|
||||
state "as" as as
|
||||
`;
|
||||
|
||||
parser.parse(str);
|
||||
});
|
||||
|
||||
it('scale', function() {
|
||||
const str = `stateDiagram\n
|
||||
scale 350 width
|
||||
|
Reference in New Issue
Block a user