Allow non-terminal extras

This commit is contained in:
Max Brunsfeld 2019-10-21 13:31:49 -07:00
parent 49c632ae90
commit fcaabea0cf
8 changed files with 274 additions and 83 deletions

View file

@ -0,0 +1,22 @@
==============
No extras
==============
a b c d
---
(module)
==============
Extras
==============
a (one) b (two) (three) c d
---
(module
(comment)
(comment)
(comment))

View file

@ -0,0 +1,35 @@
{
"name": "extra_non_terminals",
"extras": [
{"type": "PATTERN", "value": "\\s"},
{"type": "SYMBOL", "name": "comment"}
],
"rules": {
"module": {
"type": "SEQ",
"members": [
{"type": "STRING", "value": "a"},
{"type": "STRING", "value": "b"},
{"type": "STRING", "value": "c"},
{"type": "STRING", "value": "d"}
]
},
"comment": {
"type": "SEQ",
"members": [
{"type": "STRING", "value": "("},
{
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[a-z]+"
}
},
{"type": "STRING", "value": ")"}
]
}
}
}