Skip to content

Commit

Permalink
Parse None in the old parser
Browse files Browse the repository at this point in the history
  • Loading branch information
certik committed May 17, 2022
1 parent f0e48f0 commit 68e9f58
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions grammar/Python.asdl
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ module LPython
| ConstantFloat(float value, string? kind)
| ConstantComplex(float re, float im, string? kind)
| ConstantEllipsis(string? kind)
| ConstantNone(string? kind)

-- the following expression can appear in assignment context
| Attribute(expr value, identifier attr, expr_context ctx)
Expand Down
2 changes: 2 additions & 0 deletions src/runtime/lpython_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ def visit_Constant(self, node):
node.value.imag, node.kind)
elif isinstance(node.value, Ellipsis.__class__):
new_node = python_ast.ConstantEllipsis(node.kind)
elif isinstance(node.value, None.__class__):
new_node = python_ast.ConstantNone(node.kind)
else:
print(type(node.value))
raise Exception("Unsupported Constant type")
Expand Down

0 comments on commit 68e9f58

Please sign in to comment.