From 38dd2112e32e0d1a1ae0f0688d11e641bb241384 Mon Sep 17 00:00:00 2001 From: mrkkrp Date: Mon, 1 Aug 2016 22:00:36 +0300 Subject: [PATCH] Mention how to deal with case described in #129 Close #130. --- Text/Megaparsec/Expr.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Text/Megaparsec/Expr.hs b/Text/Megaparsec/Expr.hs index 83363b9..98b3551 100644 --- a/Text/Megaparsec/Expr.hs +++ b/Text/Megaparsec/Expr.hs @@ -54,6 +54,12 @@ data Operator m a -- This is not done by default because in some cases you don't want to allow -- repeating prefix or postfix operators. -- +-- If you want to have an operator that is a prefix of another operator in +-- the table, use the following (or similar) wrapper instead of plain +-- 'symbol': +-- +-- > op n = (lexeme . try) (string n <* notFollowedBy punctuationChar) +-- -- @makeExprParser@ takes care of all the complexity involved in building an -- expression parser. Here is an example of an expression parser that -- handles prefix signs, postfix increment and basic arithmetic: