Add test for non-terminal extras that share non-extra rules
This commit is contained in:
parent
81bbdf19f4
commit
9a7fdd29c2
2 changed files with 91 additions and 0 deletions
23
test/fixtures/test_grammars/extra_non_terminals_with_shared_rules/corpus.txt
vendored
Normal file
23
test/fixtures/test_grammars/extra_non_terminals_with_shared_rules/corpus.txt
vendored
Normal 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))
|
||||
68
test/fixtures/test_grammars/extra_non_terminals_with_shared_rules/grammar.json
vendored
Normal file
68
test/fixtures/test_grammars/extra_non_terminals_with_shared_rules/grammar.json
vendored
Normal 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": []
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue