1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 05:41:54 +03:00

Assign assert statement

This commit is contained in:
Rick Winfrey 2017-05-18 12:56:12 -07:00
parent 16ef36e0fc
commit 7230ed7b74

View File

@ -66,6 +66,7 @@ statement = expressionStatement
<|> identifier
<|> assignment'
<|> printStatement
<|> assertStatement
tuple :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location)
tuple = makeTerm <$> symbol Tuple <*> children (Expression.Tuple <$> (many expression))
@ -148,8 +149,8 @@ importFrom = makeTerm <$> symbol ImportFromStatement <*> (Declaration.Import <$>
-- TODO How to convert statements like this into a `Expression.Call`? The (pack "assert") produces a ByteString but that reduces the `Call` constructor to only accepting byteStrings.
-- assertStatement :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location)
-- assertStatement = makeTerm <$> symbol AssertStatement <*> children (Expression.Call <$> (symbol AnonAssert *> pack "assert" <$> many expression))
assertStatement :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location)
assertStatement = makeTerm <$ symbol AssertStatement <*> location <*> children (Expression.Call <$> (makeTerm <$> symbol AnonAssert <*> (Syntax.Identifier <$> source)) <*> many expression)
printStatement :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location)
printStatement = do