BNFC / bnfc

BNF Converter
http://bnfc.digitalgrammars.com/
586 stars 165 forks source link

RegExp: Nested subtractions are translated wrongly to Alex #256

Closed andreasabel closed 4 years ago

andreasabel commented 5 years ago

LBNF does not support nested subtraction in regexps, like in

token Name (char - [ "(){};.@\"" ] - [ " \n\t" ]) + ;

It works with parentheses:

token Name ((char - [ "(){};.@\"" ]) - [ " \n\t" ]) + ;

This is translated to Alex as

(($u # [\( \) \{ \} \; \. \@ \"]) # [\  \n \t]) +

which is rejected by Alex. However, Alex supports it without parentheses:

($u # [\( \) \{ \} \; \. \@ \"] # [\  \n \t]) +

Both BNFC and Alex are behaving silly here, I must say.

andreasabel commented 4 years ago

Fixes: