import ast
+import sys
import unittest
return await bar()
"""
+asyncvar = """\
+async = 12
+await = 13
+"""
+
+asynccomp = """\
+async def foo(xs):
+ [x async for x in xs]
+"""
+
+matmul = """\
+a = b @ c
+"""
+
+fstring = """\
+a = 42
+f"{a}"
+"""
+
+underscorednumber = """\
+a = 42_42_42
+"""
+
redundantdef = """\
def foo(): # type: () -> int
# type: () -> str
class TypeCommentTests(unittest.TestCase):
- def parse(self, source):
- return ast.parse(source, type_comments=True)
+ lowest = 4 # Lowest minor version supported
+ highest = sys.version_info[1] # Highest minor version
+
+ def parse(self, source, feature_version=highest):
+ return ast.parse(source, type_comments=True,
+ feature_version=feature_version)
+
+ def parse_all(self, source, minver=lowest, maxver=highest, expected_regex=""):
+ for feature_version in range(self.lowest, self.highest + 1):
+ if minver <= feature_version <= maxver:
+ try:
+ yield self.parse(source, feature_version)
+ except SyntaxError as err:
+ raise SyntaxError(str(err) + f" feature_version={feature_version}")
+ else:
+ with self.assertRaisesRegex(SyntaxError, expected_regex,
+ msg=f"feature_version={feature_version}"):
+ self.parse(source, feature_version)
def classic_parse(self, source):
return ast.parse(source)
def test_funcdef(self):
- tree = self.parse(funcdef)
- self.assertEqual(tree.body[0].type_comment, "() -> int")
- self.assertEqual(tree.body[1].type_comment, "() -> None")
+ for tree in self.parse_all(funcdef):
+ self.assertEqual(tree.body[0].type_comment, "() -> int")
+ self.assertEqual(tree.body[1].type_comment, "() -> None")
tree = self.classic_parse(funcdef)
self.assertEqual(tree.body[0].type_comment, None)
self.assertEqual(tree.body[1].type_comment, None)
def test_asyncdef(self):
- tree = self.parse(asyncdef)
- self.assertEqual(tree.body[0].type_comment, "() -> int")
- self.assertEqual(tree.body[1].type_comment, "() -> int")
+ for tree in self.parse_all(asyncdef, minver=5):
+ self.assertEqual(tree.body[0].type_comment, "() -> int")
+ self.assertEqual(tree.body[1].type_comment, "() -> int")
tree = self.classic_parse(asyncdef)
self.assertEqual(tree.body[0].type_comment, None)
self.assertEqual(tree.body[1].type_comment, None)
+ def test_asyncvar(self):
+ for tree in self.parse_all(asyncvar, maxver=6):
+ pass
+
+ def test_asynccomp(self):
+ for tree in self.parse_all(asynccomp, minver=6):
+ pass
+
+ def test_matmul(self):
+ for tree in self.parse_all(matmul, minver=5):
+ pass
+
+ def test_fstring(self):
+ for tree in self.parse_all(fstring, minver=6):
+ pass
+
+ def test_underscorednumber(self):
+ for tree in self.parse_all(underscorednumber, minver=6):
+ pass
+
def test_redundantdef(self):
- with self.assertRaisesRegex(SyntaxError, "^Cannot have two type comments on def"):
- tree = self.parse(redundantdef)
+ for tree in self.parse_all(redundantdef, maxver=0,
+ expected_regex="^Cannot have two type comments on def"):
+ pass
def test_nonasciidef(self):
- tree = self.parse(nonasciidef)
- self.assertEqual(tree.body[0].type_comment, "() -> àçčéñt")
+ for tree in self.parse_all(nonasciidef):
+ self.assertEqual(tree.body[0].type_comment, "() -> àçčéñt")
def test_forstmt(self):
- tree = self.parse(forstmt)
- self.assertEqual(tree.body[0].type_comment, "int")
+ for tree in self.parse_all(forstmt):
+ self.assertEqual(tree.body[0].type_comment, "int")
tree = self.classic_parse(forstmt)
self.assertEqual(tree.body[0].type_comment, None)
def test_withstmt(self):
- tree = self.parse(withstmt)
- self.assertEqual(tree.body[0].type_comment, "int")
+ for tree in self.parse_all(withstmt):
+ self.assertEqual(tree.body[0].type_comment, "int")
tree = self.classic_parse(withstmt)
self.assertEqual(tree.body[0].type_comment, None)
def test_vardecl(self):
- tree = self.parse(vardecl)
- self.assertEqual(tree.body[0].type_comment, "int")
+ for tree in self.parse_all(vardecl):
+ self.assertEqual(tree.body[0].type_comment, "int")
tree = self.classic_parse(vardecl)
self.assertEqual(tree.body[0].type_comment, None)
def test_ignores(self):
- tree = self.parse(ignores)
- self.assertEqual([ti.lineno for ti in tree.type_ignores], [2, 5])
+ for tree in self.parse_all(ignores):
+ self.assertEqual([ti.lineno for ti in tree.type_ignores], [2, 5])
tree = self.classic_parse(ignores)
self.assertEqual(tree.type_ignores, [])
def test_longargs(self):
- tree = self.parse(longargs)
- for t in tree.body:
- # The expected args are encoded in the function name
- todo = set(t.name[1:])
- self.assertEqual(len(t.args.args),
- len(todo) - bool(t.args.vararg) - bool(t.args.kwarg))
- self.assertTrue(t.name.startswith('f'), t.name)
- for c in t.name[1:]:
- todo.remove(c)
- if c == 'v':
- arg = t.args.vararg
- elif c == 'k':
- arg = t.args.kwarg
- else:
- assert 0 <= ord(c) - ord('a') < len(t.args.args)
- arg = t.args.args[ord(c) - ord('a')]
- self.assertEqual(arg.arg, c) # That's the argument name
- self.assertEqual(arg.type_comment, arg.arg.upper())
- assert not todo
+ for tree in self.parse_all(longargs):
+ for t in tree.body:
+ # The expected args are encoded in the function name
+ todo = set(t.name[1:])
+ self.assertEqual(len(t.args.args),
+ len(todo) - bool(t.args.vararg) - bool(t.args.kwarg))
+ self.assertTrue(t.name.startswith('f'), t.name)
+ for c in t.name[1:]:
+ todo.remove(c)
+ if c == 'v':
+ arg = t.args.vararg
+ elif c == 'k':
+ arg = t.args.kwarg
+ else:
+ assert 0 <= ord(c) - ord('a') < len(t.args.args)
+ arg = t.args.args[ord(c) - ord('a')]
+ self.assertEqual(arg.arg, c) # That's the argument name
+ self.assertEqual(arg.type_comment, arg.arg.upper())
+ assert not todo
tree = self.classic_parse(longargs)
for t in tree.body:
for arg in t.args.args + [t.args.vararg, t.args.kwarg]:
def check_both_ways(source):
ast.parse(source, type_comments=False)
- with self.assertRaises(SyntaxError):
- ast.parse(source, type_comments=True)
+ for tree in self.parse_all(source, maxver=0):
+ pass
check_both_ways("pass # type: int\n")
check_both_ways("foo() # type: int\n")
PyArena *c_arena; /* Arena for allocating memory. */
PyObject *c_filename; /* filename */
PyObject *c_normalize; /* Normalization function from unicodedata. */
+ int c_feature_version; /* Latest minor version of Python for allowed features */
};
static asdl_seq *seq_for_testlist(struct compiling *, const node *);
/* borrowed reference */
c.c_filename = filename;
c.c_normalize = NULL;
+ c.c_feature_version = flags->cf_feature_version;
if (TYPE(n) == encoding_decl)
n = CHILD(n, 0);
*/
static operator_ty
-get_operator(const node *n)
+get_operator(struct compiling *c, const node *n)
{
switch (TYPE(n)) {
case VBAR:
case STAR:
return Mult;
case AT:
+ if (c->c_feature_version < 5) {
+ ast_error(c, n,
+ "The '@' operator is only supported in Python 3.5 and greater");
+ return (operator_ty)0;
+ }
return MatMult;
case SLASH:
return Div;
else
return Mult;
case '@':
+ if (c->c_feature_version < 5) {
+ ast_error(c, n,
+ "The '@' operator is only supported in Python 3.5 and greater");
+ return (operator_ty)0;
+ }
return MatMult;
default:
PyErr_Format(PyExc_SystemError, "invalid augassign: %s", STR(n));
}
else if (found_default) {
ast_error(c, n,
- "non-default argument follows default argument");
+ "non-default argument follows default argument");
return NULL;
}
arg = ast_for_arg(c, ch);
node *tc;
string type_comment = NULL;
+ if (is_async && c->c_feature_version < 5) {
+ ast_error(c, n,
+ "Async functions are only supported in Python 3.5 and greater");
+ return NULL;
+ }
+
REQ(n, funcdef);
name = NEW_IDENTIFIER(CHILD(n, name_i));
static stmt_ty
ast_for_async_funcdef(struct compiling *c, const node *n, asdl_seq *decorator_seq)
{
- /* async_funcdef: 'async' funcdef */
+ /* async_funcdef: ASYNC funcdef */
REQ(n, async_funcdef);
- REQ(CHILD(n, 0), NAME);
- assert(strcmp(STR(CHILD(n, 0)), "async") == 0);
+ REQ(CHILD(n, 0), ASYNC);
REQ(CHILD(n, 1), funcdef);
return ast_for_funcdef_impl(c, n, decorator_seq,
static stmt_ty
ast_for_async_stmt(struct compiling *c, const node *n)
{
- /* async_stmt: 'async' (funcdef | with_stmt | for_stmt) */
+ /* async_stmt: ASYNC (funcdef | with_stmt | for_stmt) */
REQ(n, async_stmt);
- REQ(CHILD(n, 0), NAME);
- assert(strcmp(STR(CHILD(n, 0)), "async") == 0);
+ REQ(CHILD(n, 0), ASYNC);
switch (TYPE(CHILD(n, 1))) {
case funcdef:
n_fors++;
REQ(n, comp_for);
if (NCH(n) == 2) {
- REQ(CHILD(n, 0), NAME);
- assert(strcmp(STR(CHILD(n, 0)), "async") == 0);
+ REQ(CHILD(n, 0), ASYNC);
n = CHILD(n, 1);
}
else if (NCH(n) == 1) {
if (NCH(n) == 2) {
is_async = 1;
- REQ(CHILD(n, 0), NAME);
- assert(strcmp(STR(CHILD(n, 0)), "async") == 0);
+ REQ(CHILD(n, 0), ASYNC);
sync_n = CHILD(n, 1);
}
else {
}
REQ(sync_n, sync_comp_for);
+ /* Async comprehensions only allowed in Python 3.6 and greater */
+ if (is_async && c->c_feature_version < 6) {
+ ast_error(c, n,
+ "Async comprehensions are only supported in Python 3.6 and greater");
+ return NULL;
+ }
+
for_ch = CHILD(sync_n, 1);
t = ast_for_exprlist(c, for_ch, Store);
if (!t)
return str;
}
case NUMBER: {
- PyObject *pynum = parsenumber(c, STR(ch));
+ PyObject *pynum;
+ /* Underscores in numeric literals are only allowed in Python 3.6 or greater */
+ /* Check for underscores here rather than in parse_number so we can report a line number on error */
+ if (c->c_feature_version < 6 && strchr(STR(ch), '_') != NULL) {
+ ast_error(c, ch,
+ "Underscores in numeric literals are only supported in Python 3.6 and greater");
+ return NULL;
+ }
+ pynum = parsenumber(c, STR(ch));
if (!pynum)
return NULL;
TYPE(CHILD(ch, 3 - is_dict)) == comp_for) {
/* It's a dictionary comprehension. */
if (is_dict) {
- ast_error(c, n, "dict unpacking cannot be used in "
- "dict comprehension");
+ ast_error(c, n,
+ "dict unpacking cannot be used in dict comprehension");
return NULL;
}
res = ast_for_dictcomp(c, ch);
if (!expr2)
return NULL;
- newoperator = get_operator(CHILD(n, 1));
+ newoperator = get_operator(c, CHILD(n, 1));
if (!newoperator)
return NULL;
expr_ty tmp_result, tmp;
const node* next_oper = CHILD(n, i * 2 + 1);
- newoperator = get_operator(next_oper);
+ newoperator = get_operator(c, next_oper);
if (!newoperator)
return NULL;
REQ(n, atom_expr);
nch = NCH(n);
- if (TYPE(CHILD(n, 0)) == NAME && strcmp(STR(CHILD(n, 0)), "await") == 0) {
+ if (TYPE(CHILD(n, 0)) == AWAIT) {
+ if (c->c_feature_version < 5) {
+ ast_error(c, n,
+ "Await expressions are only supported in Python 3.5 and greater");
+ return NULL;
+ }
start = 1;
assert(nch > 1);
}
term: factor (('*'|'@'|'/'|'%'|'//') factor)*
factor: ('+'|'-'|'~') factor | power
power: atom_expr ['**' factor]
- atom_expr: ['await'] atom trailer*
+ atom_expr: [AWAIT] atom trailer*
yield_expr: 'yield' [yield_arg]
*/
node *deep, *ann = CHILD(n, 1);
int simple = 1;
+ /* AnnAssigns are only allowed in Python 3.6 or greater */
+ if (c->c_feature_version < 6) {
+ ast_error(c, ch,
+ "Variable annotation syntax is only supported in Python 3.6 and greater");
+ return NULL;
+ }
+
/* we keep track of parens to qualify (x) as expression not name */
deep = ch;
while (NCH(deep) == 1) {
int end_lineno, end_col_offset;
int has_type_comment;
string type_comment;
+
+ if (is_async && c->c_feature_version < 5) {
+ ast_error(c, n,
+ "Async for loops are only supported in Python 3.5 and greater");
+ return NULL;
+ }
+
/* for_stmt: 'for' exprlist 'in' testlist ':' [TYPE_COMMENT] suite ['else' ':' suite] */
REQ(n, for_stmt);
asdl_seq *items, *body;
string type_comment;
+ if (is_async && c->c_feature_version < 5) {
+ ast_error(c, n,
+ "Async with statements are only supported in Python 3.5 and greater");
+ return NULL;
+ }
+
REQ(n, with_stmt);
has_type_comment = TYPE(CHILD(n, NCH(n) - 2)) == TYPE_COMMENT;
str[len+2] = 0;
cf.cf_flags = PyCF_ONLY_AST;
+ cf.cf_feature_version = PY_MINOR_VERSION;
mod_n = PyParser_SimpleParseStringFlagsFilename(str, "<fstring>",
Py_eval_input, 0);
if (!mod_n) {
}
}
}
+
+ /* fstrings are only allowed in Python 3.6 and greater */
+ if (fmode && c->c_feature_version < 6) {
+ ast_error(c, n, "Format strings are only supported in Python 3.6 and greater");
+ return -1;
+ }
+
if (fmode && *bytesmode) {
PyErr_BadInternalCall();
return -1;
{1, arcs_5_2},
};
static arc arcs_6_0[1] = {
- {16, 1},
+ {38, 1},
};
static arc arcs_6_1[1] = {
{56, 2},
{1, arcs_6_2},
};
static arc arcs_7_0[1] = {
- {21, 1},
+ {19, 1},
};
static arc arcs_7_1[1] = {
{40, 2},
{1, arcs_19_1},
};
static arc arcs_20_0[1] = {
- {22, 1},
+ {20, 1},
};
static arc arcs_20_1[1] = {
{98, 2},
{1, arcs_20_2},
};
static arc arcs_21_0[1] = {
- {31, 1},
+ {29, 1},
};
static arc arcs_21_1[1] = {
{0, 1},
{1, arcs_22_1},
};
static arc arcs_23_0[1] = {
- {18, 1},
+ {16, 1},
};
static arc arcs_23_1[1] = {
{0, 1},
{1, arcs_23_1},
};
static arc arcs_24_0[1] = {
- {20, 1},
+ {18, 1},
};
static arc arcs_24_1[1] = {
{0, 1},
{1, arcs_24_1},
};
static arc arcs_25_0[1] = {
- {33, 1},
+ {31, 1},
};
static arc arcs_25_1[2] = {
{80, 2},
{1, arcs_26_1},
};
static arc arcs_27_0[1] = {
- {32, 1},
+ {30, 1},
};
static arc arcs_27_1[2] = {
{60, 2},
{0, 1},
};
static arc arcs_27_2[2] = {
- {24, 3},
+ {22, 3},
{0, 2},
};
static arc arcs_27_3[1] = {
{1, arcs_28_1},
};
static arc arcs_29_0[1] = {
- {27, 1},
+ {25, 1},
};
static arc arcs_29_1[1] = {
{106, 2},
{1, arcs_29_2},
};
static arc arcs_30_0[1] = {
- {24, 1},
+ {22, 1},
};
static arc arcs_30_1[3] = {
{107, 2},
static arc arcs_30_2[4] = {
{107, 2},
{9, 2},
- {27, 4},
+ {25, 4},
{49, 3},
};
static arc arcs_30_3[1] = {
- {27, 4},
+ {25, 4},
};
static arc arcs_30_4[3] = {
{5, 5},
{2, arcs_35_1},
};
static arc arcs_36_0[1] = {
- {25, 1},
+ {23, 1},
};
static arc arcs_36_1[1] = {
{40, 2},
{2, arcs_36_2},
};
static arc arcs_37_0[1] = {
- {29, 1},
+ {27, 1},
};
static arc arcs_37_1[1] = {
{40, 2},
{1, arcs_39_1},
};
static arc arcs_40_0[1] = {
- {16, 1},
+ {38, 1},
};
static arc arcs_40_1[3] = {
{113, 2},
{1, arcs_40_2},
};
static arc arcs_41_0[1] = {
- {26, 1},
+ {24, 1},
};
static arc arcs_41_1[1] = {
{118, 2},
{1, arcs_41_7},
};
static arc arcs_42_0[1] = {
- {35, 1},
+ {33, 1},
};
static arc arcs_42_1[1] = {
{118, 2},
{1, arcs_42_7},
};
static arc arcs_43_0[1] = {
- {23, 1},
+ {21, 1},
};
static arc arcs_43_1[1] = {
{98, 2},
{1, arcs_43_10},
};
static arc arcs_44_0[1] = {
- {34, 1},
+ {32, 1},
};
static arc arcs_44_1[1] = {
{59, 2},
{2, arcs_44_12},
};
static arc arcs_45_0[1] = {
- {36, 1},
+ {34, 1},
};
static arc arcs_45_1[1] = {
{125, 2},
{0, 1},
};
static arc arcs_50_2[2] = {
- {26, 3},
+ {24, 3},
{0, 2},
};
static arc arcs_50_3[1] = {
{1, arcs_51_1},
};
static arc arcs_52_0[1] = {
- {28, 1},
+ {26, 1},
};
static arc arcs_52_1[2] = {
{59, 2},
{1, arcs_52_4},
};
static arc arcs_53_0[1] = {
- {28, 1},
+ {26, 1},
};
static arc arcs_53_1[2] = {
{59, 2},
{2, arcs_55_1},
};
static arc arcs_56_0[2] = {
- {30, 1},
+ {28, 1},
{139, 2},
};
static arc arcs_56_1[1] = {
{146, 1},
{122, 1},
{147, 2},
- {30, 3},
+ {28, 3},
};
static arc arcs_58_1[1] = {
{0, 1},
};
static arc arcs_58_2[2] = {
- {30, 1},
+ {28, 1},
{0, 2},
};
static arc arcs_58_3[1] = {
static arc arcs_66_0[4] = {
{7, 1},
{8, 1},
- {39, 1},
+ {37, 1},
{162, 2},
};
static arc arcs_66_1[1] = {
{1, arcs_67_3},
};
static arc arcs_68_0[2] = {
- {17, 1},
+ {39, 1},
{164, 2},
};
static arc arcs_68_1[1] = {
{12, 2},
{13, 2},
{14, 3},
- {38, 4},
+ {36, 4},
{40, 2},
{41, 2},
{42, 5},
{1, arcs_77_13},
};
static arc arcs_78_0[1] = {
- {19, 1},
+ {17, 1},
};
static arc arcs_78_1[1] = {
{40, 2},
{1, arcs_81_1},
};
static arc arcs_82_0[1] = {
- {23, 1},
+ {21, 1},
};
static arc arcs_82_1[1] = {
{98, 2},
{1, arcs_82_5},
};
static arc arcs_83_0[2] = {
- {16, 1},
+ {38, 1},
{177, 2},
};
static arc arcs_83_1[1] = {
{1, arcs_83_2},
};
static arc arcs_84_0[1] = {
- {26, 1},
+ {24, 1},
};
static arc arcs_84_1[1] = {
{133, 2},
{1, arcs_85_1},
};
static arc arcs_86_0[1] = {
- {37, 1},
+ {35, 1},
};
static arc arcs_86_1[2] = {
{179, 2},
{1, arcs_86_2},
};
static arc arcs_87_0[2] = {
- {24, 1},
+ {22, 1},
{80, 2},
};
static arc arcs_87_1[1] = {
{257, "file_input", 0, 2, states_1,
"\344\377\377\377\377\027\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{258, "eval_input", 0, 3, states_2,
- "\240\173\002\120\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\240\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{259, "decorator", 0, 7, states_3,
"\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{260, "decorators", 0, 2, states_4,
{261, "decorated", 0, 3, states_5,
"\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{262, "async_funcdef", 0, 3, states_6,
- "\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{263, "funcdef", 0, 9, states_7,
- "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{264, "parameters", 0, 4, states_8,
"\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{265, "typedargslist", 0, 22, states_9,
{269, "stmt", 0, 2, states_13,
"\340\377\377\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{270, "simple_stmt", 0, 4, states_14,
- "\340\373\126\373\343\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\340\373\325\376\270\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{271, "small_stmt", 0, 2, states_15,
- "\340\373\126\373\343\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\340\373\325\376\270\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{272, "expr_stmt", 0, 6, states_16,
- "\340\173\002\120\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\340\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{273, "annassign", 0, 5, states_17,
"\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{274, "testlist_star_expr", 0, 3, states_18,
- "\340\173\002\120\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\340\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{275, "augassign", 0, 2, states_19,
"\000\000\000\000\000\000\000\000\000\000\340\377\003\000\000\000\000\000\000\000\000\000\000"},
{276, "del_stmt", 0, 3, states_20,
- "\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{277, "pass_stmt", 0, 2, states_21,
- "\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{278, "flow_stmt", 0, 2, states_22,
- "\000\000\024\000\043\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\005\300\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{279, "break_stmt", 0, 2, states_23,
- "\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{280, "continue_stmt", 0, 2, states_24,
- "\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{281, "return_stmt", 0, 3, states_25,
- "\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{282, "yield_stmt", 0, 2, states_26,
- "\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{283, "raise_stmt", 0, 5, states_27,
- "\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{284, "import_stmt", 0, 2, states_28,
- "\000\000\000\011\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\100\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{285, "import_name", 0, 3, states_29,
- "\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{286, "import_from", 0, 8, states_30,
- "\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{287, "import_as_name", 0, 4, states_31,
"\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{288, "dotted_as_name", 0, 4, states_32,
{291, "dotted_name", 0, 2, states_35,
"\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{292, "global_stmt", 0, 3, states_36,
- "\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{293, "nonlocal_stmt", 0, 3, states_37,
- "\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{294, "assert_stmt", 0, 5, states_38,
"\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{295, "compound_stmt", 0, 2, states_39,
- "\000\004\251\004\034\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\004\052\001\107\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{296, "async_stmt", 0, 3, states_40,
- "\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{297, "if_stmt", 0, 8, states_41,
- "\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{298, "while_stmt", 0, 8, states_42,
- "\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{299, "for_stmt", 0, 11, states_43,
- "\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{300, "try_stmt", 0, 13, states_44,
- "\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{301, "with_stmt", 0, 6, states_45,
- "\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{302, "with_item", 0, 4, states_46,
- "\240\173\002\120\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\240\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{303, "except_clause", 0, 5, states_47,
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000"},
{304, "suite", 0, 5, states_48,
- "\344\373\126\373\343\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\344\373\325\376\270\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{305, "namedexpr_test", 0, 4, states_49,
- "\240\173\002\120\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\240\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{306, "test", 0, 6, states_50,
- "\240\173\002\120\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\240\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{307, "test_nocond", 0, 2, states_51,
- "\240\173\002\120\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\240\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{308, "lambdef", 0, 5, states_52,
- "\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{309, "lambdef_nocond", 0, 5, states_53,
- "\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{310, "or_test", 0, 2, states_54,
- "\240\173\002\100\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\240\173\000\020\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{311, "and_test", 0, 2, states_55,
- "\240\173\002\100\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\240\173\000\020\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{312, "not_test", 0, 3, states_56,
- "\240\173\002\100\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\240\173\000\020\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{313, "comparison", 0, 2, states_57,
- "\240\173\002\000\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\240\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{314, "comp_op", 0, 4, states_58,
- "\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000\004\000\340\017\000\000\000\000"},
+ "\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000\004\000\340\017\000\000\000\000"},
{315, "star_expr", 0, 3, states_59,
"\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{316, "expr", 0, 2, states_60,
- "\240\173\002\000\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\240\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{317, "xor_expr", 0, 2, states_61,
- "\240\173\002\000\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\240\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{318, "and_expr", 0, 2, states_62,
- "\240\173\002\000\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\240\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{319, "shift_expr", 0, 2, states_63,
- "\240\173\002\000\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\240\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{320, "arith_expr", 0, 2, states_64,
- "\240\173\002\000\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\240\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{321, "term", 0, 2, states_65,
- "\240\173\002\000\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\240\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{322, "factor", 0, 3, states_66,
- "\240\173\002\000\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\240\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{323, "power", 0, 4, states_67,
- "\040\172\002\000\100\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\040\172\000\000\220\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{324, "atom_expr", 0, 3, states_68,
- "\040\172\002\000\100\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\040\172\000\000\220\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{325, "atom", 0, 9, states_69,
- "\040\172\000\000\100\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\040\172\000\000\020\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{326, "testlist_comp", 0, 5, states_70,
- "\340\173\002\120\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\340\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{327, "trailer", 0, 7, states_71,
"\040\100\000\000\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000"},
{328, "subscriptlist", 0, 3, states_72,
- "\240\173\002\120\300\007\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\240\173\000\024\260\007\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{329, "subscript", 0, 5, states_73,
- "\240\173\002\120\300\007\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\240\173\000\024\260\007\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{330, "sliceop", 0, 3, states_74,
"\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{331, "exprlist", 0, 3, states_75,
- "\340\173\002\000\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\340\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{332, "testlist", 0, 3, states_76,
- "\240\173\002\120\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\240\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{333, "dictorsetmaker", 0, 14, states_77,
- "\340\173\002\120\300\007\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\340\173\000\024\260\007\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{334, "classdef", 0, 8, states_78,
- "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{335, "arglist", 0, 3, states_79,
- "\340\173\002\120\300\007\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\340\173\000\024\260\007\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{336, "argument", 0, 4, states_80,
- "\340\173\002\120\300\007\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\340\173\000\024\260\007\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{337, "comp_iter", 0, 2, states_81,
- "\000\000\201\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\040\001\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{338, "sync_comp_for", 0, 6, states_82,
- "\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{339, "comp_for", 0, 3, states_83,
- "\000\000\201\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\040\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{340, "comp_if", 0, 4, states_84,
- "\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{341, "encoding_decl", 0, 2, states_85,
"\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{342, "yield_expr", 0, 3, states_86,
- "\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{343, "yield_arg", 0, 3, states_87,
- "\340\173\002\121\300\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\340\173\100\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{344, "func_body_suite", 0, 7, states_88,
- "\344\373\126\373\343\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\344\373\325\376\270\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{345, "func_type_input", 0, 3, states_89,
"\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{346, "func_type", 0, 6, states_90,
"\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{347, "typelist", 0, 11, states_91,
- "\340\173\002\120\300\007\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+ "\340\173\000\024\260\007\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
};
static label labels[183] = {
{0, "EMPTY"},
{1, "True"},
{9, 0},
{1, "assert"},
- {1, "async"},
- {1, "await"},
{1, "break"},
{1, "class"},
{1, "continue"},
{1, "yield"},
{25, 0},
{31, 0},
+ {56, 0},
+ {55, 0},
{1, 0},
{2, 0},
{3, 0},
{51, 0},
{11, 0},
{306, 0},
- {56, 0},
+ {58, 0},
{344, 0},
{265, 0},
{35, 0},