From 7b6663cc5947f31dfe7655b05e6a1e615b143007 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 18 May 2017 12:59:36 -0700 Subject: [PATCH] Assign global statements --- src/Language/Python/Syntax.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Language/Python/Syntax.hs b/src/Language/Python/Syntax.hs index 146d4f1c9..c120e0cb6 100644 --- a/src/Language/Python/Syntax.hs +++ b/src/Language/Python/Syntax.hs @@ -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)))