From 4b2df064c93538db62e3ea544595c0113054b9b6 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 17 May 2017 16:20:16 -0700 Subject: [PATCH] Assign Boolean --- src/Language/Python/Syntax.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Language/Python/Syntax.hs b/src/Language/Python/Syntax.hs index 10664dc60..7eecdcd97 100644 --- a/src/Language/Python/Syntax.hs +++ b/src/Language/Python/Syntax.hs @@ -28,6 +28,7 @@ type Syntax' = , Literal.Integer , Literal.None , Literal.String + , Literal.Boolean , Literal.TextElement , Statement.If , Statement.Return @@ -54,7 +55,13 @@ tuple :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location) tuple = makeTerm <$> symbol Tuple <*> children (Expression.Tuple <$> (many expression)) expression :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location) -expression = identifier <|> statement <|> unaryOperator <|> binaryOperator <|> tuple <|> literal +expression = identifier <|> statement <|> unaryOperator <|> binaryOperator <|> booleanOperator <|> tuple <|> literal <|> true <|> false + +true :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location) +true = makeTerm <$> symbol Grammar.True <*> (Literal.true <$ source) + +false :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location) +false = makeTerm <$> symbol Grammar.False <*> (Literal.false <$ source) unaryOperator :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location) unaryOperator = makeTerm <$> symbol UnaryOperator <*> children ( Expression.UCompliment <$> (symbol AnonTilde *> expression)