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

Assign simple print statements

- This does not include chevrons yet
This commit is contained in:
Rick Winfrey 2017-05-18 10:18:30 -07:00
parent ff597b3a9c
commit c7545a42fa

View File

@ -22,6 +22,7 @@ type Syntax' =
, Expression.Arithmetic , Expression.Arithmetic
, Expression.Boolean , Expression.Boolean
, Expression.Bitwise , Expression.Bitwise
, Expression.Call
, Expression.Tuple , Expression.Tuple
, Expression.Unary , Expression.Unary
, Literal.Boolean , Literal.Boolean
@ -53,6 +54,7 @@ statement = expressionStatement
<|> returnStatement <|> returnStatement
<|> identifier <|> identifier
<|> assignment' <|> assignment'
<|> printStatement
tuple :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location) tuple :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location)
tuple = makeTerm <$> symbol Tuple <*> children (Expression.Tuple <$> (many expression)) tuple = makeTerm <$> symbol Tuple <*> children (Expression.Tuple <$> (many expression))
@ -141,8 +143,8 @@ chevron = makeTerm <$> symbol Chevron <*> (Syntax.Empty <$ source)
-- assertStatement :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location) -- assertStatement :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location)
-- assertStatement = makeTerm <$> symbol AssertStatement <*> children (Expression.Call <$> (symbol AnonAssert *> pack "assert" <$> many expression)) -- assertStatement = makeTerm <$> symbol AssertStatement <*> children (Expression.Call <$> (symbol AnonAssert *> pack "assert" <$> many expression))
-- printStatement :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location) printStatement :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location)
-- printStatement = makeTerm <$ symbol PrintStatement <*> location <*> children (Expression.Call (pack "print") <$> source) printStatement = makeTerm <$ symbol PrintStatement <*> location <*> children (Expression.Call <$> (makeTerm <$> symbol AnonPrint <*> (Syntax.Identifier <$> source)) <*> (many expression))
-- globalStatement :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location) -- globalStatement :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location)
-- globalStatement = makeTerm <$ symbol GlobalStatement <*> location <*> children (some identifier) -- globalStatement = makeTerm <$ symbol GlobalStatement <*> location <*> children (some identifier)