1
1
mirror of https://github.com/github/semantic.git synced 2024-12-30 10:27:45 +03:00

Add questions for statements

This commit is contained in:
Rick Winfrey 2017-05-17 17:31:55 -07:00
parent 558706014b
commit 561dee4753

View File

@ -136,6 +136,17 @@ importFrom = makeTerm <$> symbol ImportFromStatement <*> (Declaration.Import <$>
-- TODO How should we assign chevron for print statements? -- TODO How should we assign chevron for print statements?
chevron :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location) chevron :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location)
chevron = makeTerm <$> symbol Chevron <*> (Syntax.Empty <$ source) chevron = makeTerm <$> symbol Chevron <*> (Syntax.Empty <$ source)
-- 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))
-- printStatement :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location)
-- printStatement = makeTerm <$ symbol PrintStatement <*> location <*> children (Expression.Call (pack "print") <$> source)
-- globalStatement :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location)
-- globalStatement = makeTerm <$ symbol GlobalStatement <*> location <*> children (some identifier)
returnStatement :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location) returnStatement :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location)
returnStatement = makeTerm <$> symbol ReturnStatement <*> children (Statement.Return <$> (symbol ExpressionList *> children (statement <|> literal))) returnStatement = makeTerm <$> symbol ReturnStatement <*> children (Statement.Return <$> (symbol ExpressionList *> children (statement <|> literal)))