Skip to content

RegExp: Nested subtractions are translated wrongly to Alex #256

Closed

Description

@andreasabel

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.

Activity

  1. added a commit that references this issue on Dec 15, 2019
  2. self-assigned this
    on Dec 15, 2019
  3. added this to the 2.8.4 milestone on Dec 15, 2019
  4. added
    lexer
    on Dec 15, 2019
  5. andreasabel commented on Dec 15, 2019

    @andreasabel
    MemberAuthor

    Fixes:

    • BNFC now accepts left-nested subtraction without parentheses.
    • Regex are simplified before passed to the backends.
  6. added
    LBNF
    on Dec 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

HaskellLBNFbuglexer

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions