From 01a4bd2ed4861b54b2b34486d722c96dadd2c79e Mon Sep 17 00:00:00 2001 From: Patrick Thomson Date: Tue, 4 Jun 2019 11:34:49 -0400 Subject: [PATCH] Label compound and assignment parsers and use infix chainl1. --- semantic-core/src/Data/Core/Parser.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/semantic-core/src/Data/Core/Parser.hs b/semantic-core/src/Data/Core/Parser.hs index fcce1b899..4e8df7570 100644 --- a/semantic-core/src/Data/Core/Parser.hs +++ b/semantic-core/src/Data/Core/Parser.hs @@ -47,7 +47,7 @@ core :: (TokenParsing m, Monad m) => m Core core = expr expr :: (TokenParsing m, Monad m) => m Core -expr = chainl1 atom go where +expr = atom `chainl1` go where go = choice [ (:.) <$ dot , (:$) <$ notFollowedBy dot ] @@ -64,7 +64,7 @@ atom = choice ] comp :: (TokenParsing m, Monad m) => m Core -comp = braces (sconcat <$> sepEndByNonEmpty expr semi) +comp = braces (sconcat <$> sepEndByNonEmpty expr semi) "compound statement" ifthenelse :: (TokenParsing m, Monad m) => m Core ifthenelse = If @@ -74,7 +74,7 @@ ifthenelse = If "if-then-else statement" assign :: (TokenParsing m, Monad m) => m Core -assign = (:=) <$> try (lvalue <* symbolic '=') <*> core +assign = (:=) <$> try (lvalue <* symbolic '=') <*> core "assignment" edge :: (TokenParsing m, Monad m) => m Core edge = kw <*> expr where kw = choice [ Edge Lexical <$ reserved "lexical"