Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(20735)

Delta Between Two Patch Sets: Parser/Python.asdl

Issue 11682: PEP 380 reference implementation for 3.3
Left Patch Set: Created 7 years, 10 months ago
Right Patch Set: Created 7 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 -- ASDL's four builtin types are identifier, int, string, object 1 -- ASDL's five builtin types are identifier, int, string, bytes, object
2 2
3 module Python 3 module Python
4 { 4 {
5 mod = Module(stmt* body) 5 mod = Module(stmt* body)
6 | Interactive(stmt* body) 6 | Interactive(stmt* body)
7 | Expression(expr body) 7 | Expression(expr body)
8 8
9 -- not really an actual node but useful in Jython's typesystem. 9 -- not really an actual node but useful in Jython's typesystem.
10 | Suite(stmt* body) 10 | Suite(stmt* body)
11 11
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 | UnaryOp(unaryop op, expr operand) 52 | UnaryOp(unaryop op, expr operand)
53 | Lambda(arguments args, expr body) 53 | Lambda(arguments args, expr body)
54 | IfExp(expr test, expr body, expr orelse) 54 | IfExp(expr test, expr body, expr orelse)
55 | Dict(expr* keys, expr* values) 55 | Dict(expr* keys, expr* values)
56 | Set(expr* elts) 56 | Set(expr* elts)
57 | ListComp(expr elt, comprehension* generators) 57 | ListComp(expr elt, comprehension* generators)
58 | SetComp(expr elt, comprehension* generators) 58 | SetComp(expr elt, comprehension* generators)
59 | DictComp(expr key, expr value, comprehension* generators) 59 | DictComp(expr key, expr value, comprehension* generators)
60 | GeneratorExp(expr elt, comprehension* generators) 60 | GeneratorExp(expr elt, comprehension* generators)
61 -- the grammar constrains where yield expressions can occur 61 -- the grammar constrains where yield expressions can occur
62 | Yield(int is_from, expr? value) 62 | Yield(int is_from, expr? value)
Benjamin Peterson 2011/07/09 18:41:14 I'm tempted to say add a new AST node. yield and y
Nick Coghlan 2011/09/20 13:21:02 I'm not opposed to the idea, but it's a big enough
63 -- need sequences for compare to distinguish between 63 -- need sequences for compare to distinguish between
64 -- x < 4 < 3 and (x < 4) < 3 64 -- x < 4 < 3 and (x < 4) < 3
65 | Compare(expr left, cmpop* ops, expr* comparators) 65 | Compare(expr left, cmpop* ops, expr* comparators)
66 | Call(expr func, expr* args, keyword* keywords, 66 | Call(expr func, expr* args, keyword* keywords,
67 expr? starargs, expr? kwargs) 67 expr? starargs, expr? kwargs)
68 | Num(object n) -- a number as a PyObject. 68 | Num(object n) -- a number as a PyObject.
69 | Str(string s) -- need to specify raw, unicode, etc? 69 | Str(string s) -- need to specify raw, unicode, etc?
70 » | Bytes(string s) 70 » | Bytes(bytes s)
71 | Ellipsis 71 | Ellipsis
72 -- other literals? bools? 72 -- other literals? bools?
73 73
74 -- the following expression can appear in assignment context 74 -- the following expression can appear in assignment context
75 | Attribute(expr value, identifier attr, expr_context ctx) 75 | Attribute(expr value, identifier attr, expr_context ctx)
76 | Subscript(expr value, slice slice, expr_context ctx) 76 | Subscript(expr value, slice slice, expr_context ctx)
77 | Starred(expr value, expr_context ctx) 77 | Starred(expr value, expr_context ctx)
78 | Name(identifier id, expr_context ctx) 78 | Name(identifier id, expr_context ctx)
79 | List(expr* elts, expr_context ctx) 79 | List(expr* elts, expr_context ctx)
80 | Tuple(expr* elts, expr_context ctx) 80 | Tuple(expr* elts, expr_context ctx)
(...skipping 11 matching lines...) Expand all
92 92
93 operator = Add | Sub | Mult | Div | Mod | Pow | LShift 93 operator = Add | Sub | Mult | Div | Mod | Pow | LShift
94 | RShift | BitOr | BitXor | BitAnd | FloorDiv 94 | RShift | BitOr | BitXor | BitAnd | FloorDiv
95 95
96 unaryop = Invert | Not | UAdd | USub 96 unaryop = Invert | Not | UAdd | USub
97 97
98 cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | Is | IsNot | In | NotIn 98 cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | Is | IsNot | In | NotIn
99 99
100 comprehension = (expr target, expr iter, expr* ifs) 100 comprehension = (expr target, expr iter, expr* ifs)
101 101
102 -- not sure what to call the first argument for raise and except
103 excepthandler = ExceptHandler(expr? type, identifier? name, stmt* body) 102 excepthandler = ExceptHandler(expr? type, identifier? name, stmt* body)
104 attributes (int lineno, int col_offset) 103 attributes (int lineno, int col_offset)
105 104
106 arguments = (arg* args, identifier? vararg, expr? varargannotation, 105 arguments = (arg* args, identifier? vararg, expr? varargannotation,
107 arg* kwonlyargs, identifier? kwarg, 106 arg* kwonlyargs, identifier? kwarg,
108 expr? kwargannotation, expr* defaults, 107 expr? kwargannotation, expr* defaults,
109 expr* kw_defaults) 108 expr* kw_defaults)
110 arg = (identifier arg, expr? annotation) 109 arg = (identifier arg, expr? annotation)
111 110
112 -- keyword arguments supplied to call 111 -- keyword arguments supplied to call
113 keyword = (identifier arg, expr value) 112 keyword = (identifier arg, expr value)
114 113
115 -- import name with optional 'as' alias. 114 -- import name with optional 'as' alias.
116 alias = (identifier name, identifier? asname) 115 alias = (identifier name, identifier? asname)
117 116
118 withitem = (expr context_expr, expr? optional_vars) 117 withitem = (expr context_expr, expr? optional_vars)
119 } 118 }
120 119
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+