arr-ai / wbnf

ωBNF implementation
Apache License 2.0
7 stars 4 forks source link

Allow simple regexps without /{...} #29

Closed marcelocantos closed 4 years ago

marcelocantos commented 4 years ago

Alllow some simple regexp forms without the surrounding /{…}.

marcelocantos commented 4 years ago
1. Won't this become ambiguous when sub grammars are added?

We may need to choose a different syntax for sub-grammars. We could also require that sub-grammars start with [\n, but this doesn't necessarily get us out of the woods, since regex syntax currently allows multi-line constructs.

2. Maybe consider splitting the RE rule into named terms?

You mean separate the complex and simple forms out? We could, but that would require changes in several other places and might not be worth the benefit. Also, since this is a stepping stone to full unification of regex and wbnf syntax, at which point the RE rule might disappear entirely, I'm wary of investing too much time into the current approach.