Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RegExp: Nested subtractions are translated wrongly to Alex #256

Closed
andreasabel opened this issue May 4, 2019 · 1 comment
Closed

RegExp: Nested subtractions are translated wrongly to Alex #256

andreasabel opened this issue May 4, 2019 · 1 comment
Assignees
Labels
bug Haskell LBNF Concerning the LBNF syntax and its checking lexer Concerning the generated lexer
Milestone

Comments

@andreasabel
Copy link
Member

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 added a commit that referenced this issue Dec 15, 2019
@andreasabel andreasabel self-assigned this Dec 15, 2019
@andreasabel andreasabel added this to the 2.8.4 milestone Dec 15, 2019
@andreasabel andreasabel added the lexer Concerning the generated lexer label Dec 15, 2019
@andreasabel
Copy link
Member Author

Fixes:

  • BNFC now accepts left-nested subtraction without parentheses.
  • Regex are simplified before passed to the backends.

@andreasabel andreasabel added the LBNF Concerning the LBNF syntax and its checking label Dec 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Haskell LBNF Concerning the LBNF syntax and its checking lexer Concerning the generated lexer
Projects
None yet
Development

No branches or pull requests

1 participant