Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit 01a4bd2

Browse files
author
Patrick Thomson
committed
Label compound and assignment parsers and use infix chainl1.
1 parent e9b0c45 commit 01a4bd2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

semantic-core/src/Data/Core/Parser.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ core :: (TokenParsing m, Monad m) => m Core
4747
core = expr
4848

4949
expr :: (TokenParsing m, Monad m) => m Core
50-
expr = chainl1 atom go where
50+
expr = atom `chainl1` go where
5151
go = choice [ (:.) <$ dot
5252
, (:$) <$ notFollowedBy dot
5353
]
@@ -64,7 +64,7 @@ atom = choice
6464
]
6565

6666
comp :: (TokenParsing m, Monad m) => m Core
67-
comp = braces (sconcat <$> sepEndByNonEmpty expr semi)
67+
comp = braces (sconcat <$> sepEndByNonEmpty expr semi) <?> "compound statement"
6868

6969
ifthenelse :: (TokenParsing m, Monad m) => m Core
7070
ifthenelse = If
@@ -74,7 +74,7 @@ ifthenelse = If
7474
<?> "if-then-else statement"
7575

7676
assign :: (TokenParsing m, Monad m) => m Core
77-
assign = (:=) <$> try (lvalue <* symbolic '=') <*> core
77+
assign = (:=) <$> try (lvalue <* symbolic '=') <*> core <?> "assignment"
7878

7979
edge :: (TokenParsing m, Monad m) => m Core
8080
edge = kw <*> expr where kw = choice [ Edge Lexical <$ reserved "lexical"

0 commit comments

Comments
 (0)