diff options
| author | Guido van Rossum <guido@python.org> | 2019-01-31 03:40:27 -0800 |
|---|---|---|
| committer | Ćukasz Langa <lukasz@langa.pl> | 2019-01-31 12:40:27 +0100 |
| commit | dcfcd146f8e6fc5c2fc16a4c192a0c5f5ca8c53c (patch) | |
| tree | 07829c4f286194d0e3d08151a26ef1f3494a849b /Parser/Python.asdl | |
| parent | d97daebfa69b4df95231bcae4123eacad6a48d14 (diff) | |
| download | cpython-git-dcfcd146f8e6fc5c2fc16a4c192a0c5f5ca8c53c.tar.gz | |
bpo-35766: Merge typed_ast back into CPython (GH-11645)
Diffstat (limited to 'Parser/Python.asdl')
| -rw-r--r-- | Parser/Python.asdl | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/Parser/Python.asdl b/Parser/Python.asdl index 7b2a8737ab..85b686d78a 100644 --- a/Parser/Python.asdl +++ b/Parser/Python.asdl @@ -3,17 +3,20 @@ module Python { - mod = Module(stmt* body) + mod = Module(stmt* body, type_ignore *type_ignores) | Interactive(stmt* body) | Expression(expr body) + | FunctionType(expr* argtypes, expr returns) -- not really an actual node but useful in Jython's typesystem. | Suite(stmt* body) stmt = FunctionDef(identifier name, arguments args, - stmt* body, expr* decorator_list, expr? returns) + stmt* body, expr* decorator_list, expr? returns, + string? type_comment) | AsyncFunctionDef(identifier name, arguments args, - stmt* body, expr* decorator_list, expr? returns) + stmt* body, expr* decorator_list, expr? returns, + string? type_comment) | ClassDef(identifier name, expr* bases, @@ -23,18 +26,18 @@ module Python | Return(expr? value) | Delete(expr* targets) - | Assign(expr* targets, expr value) + | Assign(expr* targets, expr value, string? type_comment) | AugAssign(expr target, operator op, expr value) -- 'simple' indicates that we annotate simple name without parens | AnnAssign(expr target, expr annotation, expr? value, int simple) -- use 'orelse' because else is a keyword in target languages - | For(expr target, expr iter, stmt* body, stmt* orelse) - | AsyncFor(expr target, expr iter, stmt* body, stmt* orelse) + | For(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment) + | AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment) | While(expr test, stmt* body, stmt* orelse) | If(expr test, stmt* body, stmt* orelse) - | With(withitem* items, stmt* body) - | AsyncWith(withitem* items, stmt* body) + | With(withitem* items, stmt* body, string? type_comment) + | AsyncWith(withitem* items, stmt* body, string? type_comment) | Raise(expr? exc, expr? cause) | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody) @@ -111,7 +114,7 @@ module Python arguments = (arg* args, arg? vararg, arg* kwonlyargs, expr* kw_defaults, arg? kwarg, expr* defaults) - arg = (identifier arg, expr? annotation) + arg = (identifier arg, expr? annotation, string? type_comment) attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset) -- keyword arguments supplied to call (NULL identifier for **kwargs) @@ -121,5 +124,7 @@ module Python alias = (identifier name, identifier? asname) withitem = (expr context_expr, expr? optional_vars) + + type_ignore = TypeIgnore(int lineno) } |
