Add test for non-terminal extras that share non-extra rules

This commit is contained in:
Max Brunsfeld 2020-07-29 09:53:07 -07:00
parent 81bbdf19f4
commit 9a7fdd29c2
2 changed files with 91 additions and 0 deletions

View file

@ -0,0 +1,23 @@
=====
Extras
=====
;
%;
%foo:;
;
bar: baz:;
;
---
(program
(statement)
(macro_statement (statement))
(macro_statement (statement
(label_declaration (identifier))))
(statement)
(statement
(label_declaration (identifier))
(label_declaration (identifier)))
(statement))

View file

@ -0,0 +1,68 @@
{
"name": "extra_non_terminals_with_shared_rules",
"extras": [
{ "type": "PATTERN", "value": "\\s+" },
{ "type": "SYMBOL", "name": "macro_statement" }
],
"rules": {
"program": {
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "statement"
}
},
"statement": {
"type": "SEQ",
"members": [
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "label_declaration"
}
},
{
"type": "STRING",
"value": ";"
}
]
},
"macro_statement": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "%"
},
{
"type": "SYMBOL",
"name": "statement"
}
]
},
"label_declaration": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "STRING",
"value": ":"
}
]
},
"identifier": {
"type": "PATTERN",
"value": "[a-zA-Z]+"
}
},
"conflicts": [],
"externals": [],
"inline": [],
"supertypes": []
}