Skip to content

Examples for solving conflicts with negative predicates #69

Description

@twolodzko

Describe the bug

Negative predicate following a positive match of the same symbol seem to conflict with each other when parsing. This may be either bug or a case for documentation improvements if I'm understanding something incorrectly.

To Reproduce

For a trivial language:

expr = { term ~ (op ~ term)* }
term = { atom ~ ( bang ~ !"=" )? }
atom = _{ value | "(" ~ expr ~ ")" }
bang = { "!" }
op = { "+" | "-" | "=" | "!=" }
value = { ASCII_ALPHANUMERIC+ }
WHITESPACE = { " " }

I would expect something like x! = 2 to parse as value ~ bang ~ op ~ value, but it does not. I was trying to add positive predicates for whitespaces etc as well, but with no luck to make it work.

x != 2 and (x!)=2 and x!=2 parse correctly.

Expected behavior

x! = 2 parses correctly as value ~ bang ~ op ~ value.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions