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

Assign global statements

This commit is contained in:
Rick Winfrey 2017-05-18 12:59:36 -07:00
parent 7230ed7b74
commit 7b6663cc59

View File

@ -67,6 +67,7 @@ statement = expressionStatement
<|> assignment'
<|> printStatement
<|> assertStatement
<|> globalStatement
tuple :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location)
tuple = makeTerm <$> symbol Tuple <*> children (Expression.Tuple <$> (many expression))
@ -163,8 +164,8 @@ printStatement = do
redirectCallTerm location keyword = makeTerm location <$ symbol Chevron <*> (flip Redirect <$> children expression <*> printCallTerm location keyword)
printCallTerm location keyword = makeTerm location . Expression.Call keyword <$> many expression
-- globalStatement :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location)
-- globalStatement = makeTerm <$ symbol GlobalStatement <*> location <*> children (some identifier)
globalStatement :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location)
globalStatement = makeTerm <$ symbol GlobalStatement <*> location <*> children (Expression.Call <$> (makeTerm <$> symbol AnonGlobal <*> (Syntax.Identifier <$> source)) <*> many identifier)
returnStatement :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location)
returnStatement = makeTerm <$> symbol ReturnStatement <*> children (Statement.Return <$> (symbol ExpressionList *> children (statement <|> literal)))