Skip to content

Commit

Permalink
Parse ellipsis (...) 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 bb41e2d commit f0e48f0
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 @@ -83,6 +83,7 @@ module LPython
| ConstantBool(bool value, string? kind)
| ConstantFloat(float value, string? kind)
| ConstantComplex(float re, float im, string? kind)
| ConstantEllipsis(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 @@ -50,6 +50,8 @@ def visit_Constant(self, node):
elif isinstance(node.value, complex):
new_node = python_ast.ConstantComplex(node.value.real,
node.value.imag, node.kind)
elif isinstance(node.value, Ellipsis.__class__):
new_node = python_ast.ConstantEllipsis(node.kind)
else:
print(type(node.value))
raise Exception("Unsupported Constant type")
Expand Down

0 comments on commit f0e48f0

Please sign in to comment.