summaryrefslogtreecommitdiff
path: root/Logstat/Parse.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Logstat/Parse.hs')
-rw-r--r--Logstat/Parse.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/Logstat/Parse.hs b/Logstat/Parse.hs
index 6484948..24ee5cc 100644
--- a/Logstat/Parse.hs
+++ b/Logstat/Parse.hs
@@ -140,9 +140,10 @@ stmts end = concat <$> sepEndBy1 stmt (symbol ";") <* end
<|> between (symbol "(") (symbol ")") expr
expr = makeExprParser term
- [ [ Prefix (foldr1 (.) <$> some (ENot <$ (symbol "!")))
+ [ [ InfixR (EOp OPow <$ symbol "**") ]
+ , [ Prefix (foldr1 (.) <$> some (ENot <$ (symbol "!")))
, Prefix (ENeg <$ symbol "-" ) ]
- , [ InfixL (EOp OMul <$ symbol "*" )
+ , [ InfixL (EOp OMul <$ (lexeme $ try $ char '*' <* notFollowedBy (char '*')))
, InfixL (EOp ODiv <$ symbol "/" )
, InfixL (EOp OMod <$ symbol "%" ) ]
, [ InfixL (EOp OPlus <$ symbol "+" )
@@ -162,6 +163,7 @@ stmts end = concat <$> sepEndBy1 stmt (symbol ";") <* end
, InfixN (EOp OINeq <$ symbol "!=") ]
, [ InfixL (EOp OAnd <$ symbol "&&") ]
, [ InfixL (EOp OOr <$ symbol "||") ]
+ , [ InfixR (try $ between (symbol "?") (symbol ":") expr >>= \m -> return $ (\l r -> EIf l m r)) ]
]
number = lexeme $ try L.float