parsec icon indicating copy to clipboard operation
parsec copied to clipboard

conflict between infix and prefix ops in `Text.Parser.Expr`

Open vizietto opened this issue 8 years ago • 0 comments

The function buildExpressionParser in module Text.Parser.Expr has a bug. In the uncommon case where a prefix operator has lower precedence than an infix operator, such as in boolean expressions, e.g

  • && is an infix operator.
  • ! is a prefix operator of lower precedence.

The input !a && b is correctly parsed Not (And a b), but the parser fails to parse a && !b (as And a (Not b)).

vizietto avatar Aug 12 '16 19:08 vizietto