Skip to content

Commit

Permalink
Python.asdl: few modifications to compile it
Browse files Browse the repository at this point in the history
  • Loading branch information
certik committed Nov 17, 2021
1 parent fd66fae commit 3bd173e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions grammar/Python.asdl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module Python
| Assert(expr test, expr? msg)

| Import(alias* names)
| ImportFrom(identifier? module, alias* names, int? level)
| ImportFrom(identifier? module, alias* names, int level)

| Global(identifier* names)
| Nonlocal(identifier* names)
Expand Down Expand Up @@ -72,9 +72,9 @@ module Python
| YieldFrom(expr value)
-- need sequences for compare to distinguish between
-- x < 4 < 3 and (x < 4) < 3
| Compare(expr left, cmpop* ops, expr* comparators)
| Compare(expr left, cmpop ops, expr* comparators)
| Call(expr func, expr* args, keyword* keywords)
| FormattedValue(expr value, int? conversion, expr? format_spec)
| FormattedValue(expr value, int conversion, expr? format_spec)
| JoinedStr(expr* values)
-- | Constant(constant value, string? kind)
-- Our specific nodes that are used instead of Constant:
Expand Down Expand Up @@ -113,8 +113,8 @@ module Python
excepthandler = ExceptHandler(expr? type, identifier? name, stmt* body)
attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)

arguments = (arg* posonlyargs, arg* args, arg? vararg, arg* kwonlyargs,
expr* kw_defaults, arg? kwarg, expr* defaults)
arguments = (arg* posonlyargs, arg* args, arg* vararg, arg* kwonlyargs,
expr* kw_defaults, arg* kwarg, expr* defaults)

arg = (identifier arg, expr? annotation, string? type_comment)
attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)
Expand All @@ -132,7 +132,8 @@ module Python
match_case = (pattern pattern, expr? guard, stmt* body)

pattern = MatchValue(expr value)
| MatchSingleton(constant value)
-- | MatchSingleton(constant value)
| MatchSingleton(expr value)
| MatchSequence(pattern* patterns)
| MatchMapping(expr* keys, pattern* patterns, identifier? rest)
| MatchClass(expr cls, pattern* patterns, identifier* kwd_attrs, pattern* kwd_patterns)
Expand Down

0 comments on commit 3bd173e

Please sign in to comment.