1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 16:02:43 +03:00

assign binds looser than application.

This commit is contained in:
Rob Rix 2019-07-23 15:07:21 -04:00
parent 59af553279
commit 08878f1a18
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -50,7 +50,10 @@ core :: (TokenParsing m, Monad m) => m (Term Core User)
core = expr
expr :: (TokenParsing m, Monad m) => m (Term Core User)
expr = application
expr = assign
assign :: (TokenParsing m, Monad m) => m (Term Core User)
assign = application <**> (flip (Core..=) <$ symbolic '=' <*> application <|> pure id) <?> "assignment"
application :: (TokenParsing m, Monad m) => m (Term Core User)
application = projection `chainl1` (pure (Core.$$))
@ -66,7 +69,6 @@ atom = choice
, lit
, ident
, rec
, assign
, parens expr
]
@ -89,9 +91,6 @@ ifthenelse = Core.if'
rec :: (TokenParsing m, Monad m) => m (Term Core User)
rec = Core.rec <$ reserved "rec" <*> name <* symbolic '=' <*> expr <?> "recursive binding"
assign :: (TokenParsing m, Monad m) => m (Term Core User)
assign = (Core..=) <$> try (lvalue <* symbolic '=') <*> expr <?> "assignment"
edge :: (TokenParsing m, Monad m) => m (Term Core User)
edge = Core.load <$ reserved "load" <*> expr