mirror of
https://github.com/github/semantic.git
synced 2024-11-28 01:47:01 +03:00
Parse binding statements.
This commit is contained in:
parent
a39e7730ea
commit
a77ecdbe78
@ -1,3 +1,4 @@
|
|||||||
|
{-# LANGUAGE TypeOperators #-}
|
||||||
module Data.Core.Parser
|
module Data.Core.Parser
|
||||||
( module Text.Trifecta
|
( module Text.Trifecta
|
||||||
, core
|
, core
|
||||||
@ -67,7 +68,13 @@ atom = choice
|
|||||||
]
|
]
|
||||||
|
|
||||||
comp :: (TokenParsing m, Monad m) => m (Term Core User)
|
comp :: (TokenParsing m, Monad m) => m (Term Core User)
|
||||||
comp = braces (Core.block <$> sepEndByNonEmpty expr semi) <?> "compound statement"
|
comp = braces (Core.do' <$> sepEndByNonEmpty statement semi) <?> "compound statement"
|
||||||
|
|
||||||
|
statement :: (TokenParsing m, Monad m) => m (Maybe (Named User) Core.:<- Term Core User)
|
||||||
|
statement
|
||||||
|
= try ((Core.:<-) . Just <$> name <* symbol "<-" <*> expr)
|
||||||
|
<|> (Nothing Core.:<-) <$> expr
|
||||||
|
<?> "statement"
|
||||||
|
|
||||||
ifthenelse :: (TokenParsing m, Monad m) => m (Term Core User)
|
ifthenelse :: (TokenParsing m, Monad m) => m (Term Core User)
|
||||||
ifthenelse = Core.if'
|
ifthenelse = Core.if'
|
||||||
|
Loading…
Reference in New Issue
Block a user