Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pie): fix sectoin eof and rename title accessiblity #64

Merged
merged 1 commit into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
215 changes: 111 additions & 104 deletions packages/mermaid-parser/src/language/generated/grammar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const MermaidGrammar = (): Grammar => loadedMermaidGrammar ?? (loadedMerm
{
"$type": "RuleCall",
"rule": {
"$ref": "#/rules@7"
"$ref": "#/rules@8"
},
"arguments": [],
"cardinality": "*"
Expand All @@ -61,31 +61,58 @@ export const MermaidGrammar = (): Grammar => loadedMermaidGrammar ?? (loadedMerm
{
"$type": "RuleCall",
"rule": {
"$ref": "#/rules@7"
"$ref": "#/rules@8"
},
"arguments": [],
"cardinality": "*"
},
{
"$type": "RuleCall",
"rule": {
"$ref": "#/rules@12"
"$ref": "#/rules@3"
},
"arguments": [],
"cardinality": "?"
},
{
"$type": "Assignment",
"feature": "sections",
"operator": "+=",
"terminal": {
"$type": "RuleCall",
"rule": {
"$ref": "#/rules@2"
"$type": "Group",
"elements": [
{
"$type": "Group",
"elements": [
{
"$type": "RuleCall",
"rule": {
"$ref": "#/rules@8"
},
"arguments": [],
"cardinality": "+"
},
{
"$type": "Assignment",
"feature": "sections",
"operator": "+=",
"terminal": {
"$type": "RuleCall",
"rule": {
"$ref": "#/rules@2"
},
"arguments": []
}
}
],
"cardinality": "+"
},
"arguments": []
},
"cardinality": "*"
{
"$type": "RuleCall",
"rule": {
"$ref": "#/rules@8"
},
"arguments": [],
"cardinality": "*"
}
],
"cardinality": "?"
}
]
},
Expand All @@ -108,7 +135,7 @@ export const MermaidGrammar = (): Grammar => loadedMermaidGrammar ?? (loadedMerm
"terminal": {
"$type": "RuleCall",
"rule": {
"$ref": "#/rules@9"
"$ref": "#/rules@10"
},
"arguments": []
}
Expand All @@ -124,36 +151,92 @@ export const MermaidGrammar = (): Grammar => loadedMermaidGrammar ?? (loadedMerm
"terminal": {
"$type": "RuleCall",
"rule": {
"$ref": "#/rules@8"
"$ref": "#/rules@9"
},
"arguments": []
}
}
]
},
"definesHiddenTokens": false,
"entry": false,
"fragment": false,
"hiddenTokens": [],
"parameters": [],
"wildcard": false
},
{
"$type": "ParserRule",
"name": "TITLE_AND_ACCESSIBILITIES",
"fragment": true,
"definition": {
"$type": "UnorderedGroup",
"elements": [
{
"$type": "Assignment",
"feature": "accDescr",
"operator": "=",
"terminal": {
"$type": "RuleCall",
"rule": {
"$ref": "#/rules@4"
},
"arguments": []
}
},
{
"$type": "Alternatives",
"$type": "Assignment",
"feature": "accTitle",
"operator": "=",
"terminal": {
"$type": "RuleCall",
"rule": {
"$ref": "#/rules@5"
},
"arguments": []
}
},
{
"$type": "Group",
"elements": [
{
"$type": "RuleCall",
"rule": {
"$ref": "#/rules@5"
},
"arguments": []
"$type": "Assignment",
"feature": "title",
"operator": "=",
"terminal": {
"$type": "RuleCall",
"rule": {
"$ref": "#/rules@7"
},
"arguments": []
}
},
{
"$type": "RuleCall",
"rule": {
"$ref": "#/rules@7"
},
"arguments": [],
"cardinality": "+"
"$type": "Alternatives",
"elements": [
{
"$type": "RuleCall",
"rule": {
"$ref": "#/rules@6"
},
"arguments": []
},
{
"$type": "RuleCall",
"rule": {
"$ref": "#/rules@8"
},
"arguments": [],
"cardinality": "+"
}
]
}
]
}
]
},
"definesHiddenTokens": false,
"entry": false,
"fragment": false,
"hiddenTokens": [],
"parameters": [],
"wildcard": false
Expand Down Expand Up @@ -251,82 +334,6 @@ export const MermaidGrammar = (): Grammar => loadedMermaidGrammar ?? (loadedMerm
"regex": "[ \\\\r\\\\t]+"
},
"fragment": false
},
{
"$type": "ParserRule",
"name": "DESCR_AND_TITLES",
"fragment": true,
"definition": {
"$type": "UnorderedGroup",
"elements": [
{
"$type": "Assignment",
"feature": "accDescr",
"operator": "=",
"terminal": {
"$type": "RuleCall",
"rule": {
"$ref": "#/rules@3"
},
"arguments": []
}
},
{
"$type": "Assignment",
"feature": "accTitle",
"operator": "=",
"terminal": {
"$type": "RuleCall",
"rule": {
"$ref": "#/rules@4"
},
"arguments": []
}
},
{
"$type": "Group",
"elements": [
{
"$type": "Assignment",
"feature": "title",
"operator": "=",
"terminal": {
"$type": "RuleCall",
"rule": {
"$ref": "#/rules@6"
},
"arguments": []
}
},
{
"$type": "Alternatives",
"elements": [
{
"$type": "RuleCall",
"rule": {
"$ref": "#/rules@5"
},
"arguments": []
},
{
"$type": "RuleCall",
"rule": {
"$ref": "#/rules@7"
},
"arguments": [],
"cardinality": "+"
}
]
}
]
}
]
},
"definesHiddenTokens": false,
"entry": false,
"hiddenTokens": [],
"parameters": [],
"wildcard": false
}
],
"definesHiddenTokens": false,
Expand Down
13 changes: 6 additions & 7 deletions packages/mermaid-parser/src/language/grammars/common.langium
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/* fragments */
fragment TITLE_AND_ACCESSIBILITIES:
accDescr=ACC_DESCR & accTitle=ACC_TITLE & title=TITLE
(EOF | NEWLINE+)
;

/* terminals */
// placeholder terminals
terminal ACC_DESCR: /accDescr/;
Expand All @@ -12,10 +18,3 @@ terminal STRING: /"[^"]*"/;
// hidden terminals
hidden terminal COMMENT: /%%(?!{(.|\n)*}%%).*/;
hidden terminal WHITESPACE: /[ \r\t]+/;


/* fragments */
fragment DESCR_AND_TITLES:
accDescr=ACC_DESCR & accTitle=ACC_TITLE & title=TITLE
(EOF | NEWLINE+)
;
6 changes: 3 additions & 3 deletions packages/mermaid-parser/src/language/grammars/pie.langium
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import "./common";
entry PieChart:
NEWLINE*
"pie" (showData?="showData")? NEWLINE*
DESCR_AND_TITLES?
sections+=Section*
TITLE_AND_ACCESSIBILITIES?
((NEWLINE+ sections+=Section)+ NEWLINE*)?
;

Section:
label=STRING ":" value=NUMBER (EOF | NEWLINE+)
label=STRING ":" value=NUMBER
;