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

Unary Operators in expressions cannot parse other operators on right hand #20

Open
1 of 4 tasks
JPVenson opened this issue Nov 24, 2021 · 2 comments
Open
1 of 4 tasks
Assignees
Labels

Comments

@JPVenson
Copy link
Owner

Describe the bug
Assume an expression like this:
e > 5 && e < 8
The ExpressionParser will parse the expression like this:
(e > 5 && e) < 8

To Reproduce

Expected behavior
Expected the parser to parse the expression like this: (e > 5) && (e < 8)

Desktop (please complete the following information):

  • OS: WIN10
  • Version 5.0.1.534
  • Got code from
  • CodeProject
  • Nuget
  • Github
  • Elsewhere (please define)

Additional context

@JPVenson JPVenson self-assigned this Nov 24, 2021
@JPVenson JPVenson added the bug label Nov 24, 2021
@JPVenson
Copy link
Owner Author

To fix this, the ExpressionParser has to be extended to allow greedy parsing of tokens instead of lazy

@JPVenson
Copy link
Owner Author

Workaround is to write the expression with brackets to tell the parser how to evaluate the conditions like this:
e > 5 && (e < 8) or (e > 5) && (e < 8)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant