mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-16 02:34:41 +01:00
Tweaked PIE (got rid of some parsing conflicts)
This commit is contained in:
@@ -526,7 +526,7 @@ This might need adjustment to match your locale and preferences
|
|||||||
|
|
||||||
## journey
|
## journey
|
||||||
|
|
||||||
The object containing configurations specific for sequence diagrams
|
The object containing configurations specific for journey diagrams
|
||||||
|
|
||||||
### diagramMarginX
|
### diagramMarginX
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,8 @@
|
|||||||
[\n\r]+ return 'NEWLINE';
|
[\n\r]+ return 'NEWLINE';
|
||||||
\%\%[^\n]* /* do nothing */
|
\%\%[^\n]* /* do nothing */
|
||||||
[\s]+ /* ignore */
|
[\s]+ /* ignore */
|
||||||
title { console.log('starting title');this.begin("title");return 'title'; }
|
title { this.begin("title");return 'title'; }
|
||||||
<title>([^(?:\n#;)]*) { this.popState(); return "title_value"; }
|
<title>(?!\n|;|#)*[^\n]* { this.popState(); return "title_value"; }
|
||||||
["] { this.begin("string"); }
|
["] { this.begin("string"); }
|
||||||
<string>["] { this.popState(); }
|
<string>["] { this.popState(); }
|
||||||
<string>[^"]* { return "txt"; }
|
<string>[^"]* { return "txt"; }
|
||||||
@@ -41,9 +41,9 @@ title { console.log('s
|
|||||||
%% /* language grammar */
|
%% /* language grammar */
|
||||||
|
|
||||||
start
|
start
|
||||||
: eol start { console.warn('NEWLINE start'); }
|
: eol start
|
||||||
| directive start { console.warn('directive start'); }
|
| directive start
|
||||||
| PIE document EOF { console.warn('PIE document EOF'); }
|
| PIE document
|
||||||
;
|
;
|
||||||
|
|
||||||
document
|
document
|
||||||
@@ -52,8 +52,7 @@ document
|
|||||||
;
|
;
|
||||||
|
|
||||||
line
|
line
|
||||||
: statement { $$ = $1 }
|
: statement eol { $$ = $1 }
|
||||||
| eol { $$=[]; }
|
|
||||||
;
|
;
|
||||||
|
|
||||||
statement
|
statement
|
||||||
@@ -69,10 +68,9 @@ directive
|
|||||||
;
|
;
|
||||||
|
|
||||||
eol
|
eol
|
||||||
:
|
: NEWLINE
|
||||||
| SPACE eol
|
| ';'
|
||||||
| NEWLINE eol
|
| EOF
|
||||||
| ';' eol
|
|
||||||
;
|
;
|
||||||
|
|
||||||
openDirective
|
openDirective
|
||||||
|
|||||||
@@ -12,6 +12,15 @@ describe('when parsing pie', function() {
|
|||||||
pie.parser.yy = pieDb;
|
pie.parser.yy = pieDb;
|
||||||
pie.parser.yy.clear();
|
pie.parser.yy.clear();
|
||||||
});
|
});
|
||||||
|
it('should handle very simple pie', function() {
|
||||||
|
const res = pie.parser.parse(`pie
|
||||||
|
"ash" : 100
|
||||||
|
`);
|
||||||
|
const sections = pieDb.getSections();
|
||||||
|
console.log('sections: ', sections);
|
||||||
|
const section1 = sections['ash'];
|
||||||
|
expect(section1).toBe(100);
|
||||||
|
});
|
||||||
it('should handle simple pie', function() {
|
it('should handle simple pie', function() {
|
||||||
const res = pie.parser.parse(`pie
|
const res = pie.parser.parse(`pie
|
||||||
"ash" : 60
|
"ash" : 60
|
||||||
|
|||||||
Reference in New Issue
Block a user