Patch #1550786: ellipsis literal.

This commit is contained in:
Georg Brandl 2006-09-06 07:06:08 +00:00
parent 7cae87ca7b
commit 52318d6215
19 changed files with 140 additions and 141 deletions

View File

@ -26,6 +26,8 @@ A small number of constants live in the built-in namespace. They are:
\end{datadesc}
\begin{datadesc}{Ellipsis}
Special value used in conjunction with extended slicing syntax.
The same as \code{...}.
Special value used mostly in conjunction with extended slicing syntax
for user-defined container data types.
% XXX Someone who understands extended slicing should fill in here.
\end{datadesc}

View File

@ -2004,12 +2004,12 @@ It is written as \code{None}.
\subsection{The Ellipsis Object \label{bltin-ellipsis-object}}
This object is used by extended slice notation (see the
This object is mostly used by extended slice notation (see the
\citetitle[../ref/ref.html]{Python Reference Manual}). It supports no
special operations. There is exactly one ellipsis object, named
\constant{Ellipsis} (a built-in name).
It is written as \code{Ellipsis}.
It is written as \code{Ellipsis} or \code{...}.
\subsection{Boolean Values}

View File

@ -148,9 +148,8 @@ fallback, depending on the operator.) Its truth value is true.
\item[Ellipsis]
This type has a single value. There is a single object with this value.
This object is accessed through the built-in name \code{Ellipsis}.
It is used to indicate the presence of the \samp{...} syntax in a
slice. Its truth value is true.
This object is accessed through the literal \code{...} or the
built-in name \code{Ellipsis}. Its truth value is true.
\obindex{Ellipsis}
\item[Numbers]

View File

@ -411,8 +411,7 @@ is constructed from the slice list, as follows. If the slice list
contains at least one comma, the key is a tuple containing the
conversion of the slice items; otherwise, the conversion of the lone
slice item is the key. The conversion of a slice item that is an
expression is that expression. The conversion of an ellipsis slice
item is the built-in \code{Ellipsis} object. The conversion of a
expression is that expression. The conversion of a
proper slice is a slice object (see section \ref{types}) whose
\member{start}, \member{stop} and \member{step} attributes are the
values of the expressions given as lower bound, upper bound and

View File

@ -101,13 +101,13 @@ power: atom trailer* ['**' factor]
atom: ('(' [yield_expr|testlist_gexp] ')' |
'[' [listmaker] ']' |
'{' [dictsetmaker] '}' |
NAME | NUMBER | STRING+)
NAME | NUMBER | STRING+ | '.' '.' '.')
listmaker: test ( list_for | (',' test)* [','] )
testlist_gexp: test ( gen_for | (',' test)* [','] )
lambdef: 'lambda' [varargslist] ':' test
trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME
subscriptlist: subscript (',' subscript)* [',']
subscript: '.' '.' '.' | test | [test] ':' [test] [sliceop]
subscript: test | [test] ':' [test] [sliceop]
sliceop: ':' [test]
exprlist: expr (',' expr)* [',']
testlist: test (',' test)* [',']

View File

@ -180,8 +180,9 @@ struct _stmt {
enum _expr_kind {BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4,
IfExp_kind=5, Dict_kind=6, Set_kind=7, ListComp_kind=8,
GeneratorExp_kind=9, Yield_kind=10, Compare_kind=11,
Call_kind=12, Num_kind=13, Str_kind=14, Attribute_kind=15,
Subscript_kind=16, Name_kind=17, List_kind=18, Tuple_kind=19};
Call_kind=12, Num_kind=13, Str_kind=14, Ellipsis_kind=15,
Attribute_kind=16, Subscript_kind=17, Name_kind=18,
List_kind=19, Tuple_kind=20};
struct _expr {
enum _expr_kind kind;
union {
@ -289,7 +290,7 @@ struct _expr {
int col_offset;
};
enum _slice_kind {Ellipsis_kind=1, Slice_kind=2, ExtSlice_kind=3, Index_kind=4};
enum _slice_kind {Slice_kind=1, ExtSlice_kind=2, Index_kind=3};
struct _slice {
enum _slice_kind kind;
union {
@ -408,6 +409,7 @@ expr_ty Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty
*arena);
expr_ty Num(object n, int lineno, int col_offset, PyArena *arena);
expr_ty Str(string s, int lineno, int col_offset, PyArena *arena);
expr_ty Ellipsis(int lineno, int col_offset, PyArena *arena);
expr_ty Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int
lineno, int col_offset, PyArena *arena);
expr_ty Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int
@ -418,7 +420,6 @@ expr_ty List(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset,
PyArena *arena);
expr_ty Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset,
PyArena *arena);
slice_ty Ellipsis(PyArena *arena);
slice_ty Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena);
slice_ty ExtSlice(asdl_seq * dims, PyArena *arena);
slice_ty Index(expr_ty value, PyArena *arena);

View File

@ -427,19 +427,6 @@ class Div(Node):
def __repr__(self):
return "Div((%s, %s))" % (repr(self.left), repr(self.right))
class Ellipsis(Node):
def __init__(self, lineno=None):
self.lineno = lineno
def getChildren(self):
return ()
def getChildNodes(self):
return ()
def __repr__(self):
return "Ellipsis()"
class FloorDiv(Node):
def __init__(self, (left, right), lineno=None):
self.left = left

View File

@ -1214,9 +1214,6 @@ class CodeGenerator:
# object constructors
def visitEllipsis(self, node):
self.emit('LOAD_CONST', Ellipsis)
def visitTuple(self, node):
self.set_lineno(node)
for elt in node.nodes:

View File

@ -113,6 +113,7 @@ class Transformer:
token.LBRACE: self.atom_lbrace,
token.NUMBER: self.atom_number,
token.STRING: self.atom_string,
token.DOT: self.atom_ellipsis,
token.NAME: self.atom_name,
}
self.encoding = None
@ -747,6 +748,9 @@ class Transformer:
k += self.decode_literal(node[1])
return Const(k, lineno=nodelist[0][2])
def atom_ellipsis(self, nodelist):
return Const(Ellipsis, lineno=nodelist[0][2])
def atom_name(self, nodelist):
return Name(nodelist[0][1], lineno=nodelist[0][2])
@ -1276,11 +1280,9 @@ class Transformer:
lineno=extractLineNo(nodelist))
def com_subscript(self, node):
# slice_item: expression | proper_slice | ellipsis
# slice_item: expression | proper_slice
ch = node[1]
t = ch[0]
if t == token.DOT and node[2][0] == token.DOT:
return Ellipsis()
if t == token.COLON or len(node) > 2:
return self.com_sliceobj(node)
return self.com_node(ch)

View File

@ -7,6 +7,7 @@ test_grammar
1.1.2.2 Long integers
1.1.2.3 Floating point
1.1.3 String literals
1.1.4 Ellipsis literal
1.2 Grammar
single_input
file_input

View File

@ -125,6 +125,12 @@ the \'lazy\' dog.\n\
'; verify(x == y)
print '1.1.4 Ellipsis literal'
x = ...
verify(x == Ellipsis)
print '1.2 Grammar'
print 'single_input' # NEWLINE | simple_stmt | compound_stmt NEWLINE

View File

@ -2385,6 +2385,11 @@ validate_atom(node *tree)
for (pos = 1; res && (pos < nch); ++pos)
res = validate_ntype(CHILD(tree, pos), STRING);
break;
case DOT:
res = (nch == 3 &&
validate_ntype(CHILD(tree, 1), DOT) &&
validate_ntype(CHILD(tree, 2), DOT));
break;
default:
res = 0;
break;

View File

@ -63,6 +63,7 @@ module Python version "$Revision$"
expr? starargs, expr? kwargs)
| Num(object n) -- a number as a PyObject.
| Str(string s) -- need to specify raw, unicode, etc?
| Ellipsis
-- other literals? bools?
-- the following expression can appear in assignment context
@ -77,7 +78,7 @@ module Python version "$Revision$"
expr_context = Load | Store | Del | AugLoad | AugStore | Param
slice = Ellipsis | Slice(expr? lower, expr? upper, expr? step)
slice = Slice(expr? lower, expr? upper, expr? step)
| ExtSlice(slice* dims)
| Index(expr value)

View File

@ -212,6 +212,7 @@ static PyTypeObject *Str_type;
static char *Str_fields[]={
"s",
};
static PyTypeObject *Ellipsis_type;
static PyTypeObject *Attribute_type;
static char *Attribute_fields[]={
"value",
@ -251,7 +252,6 @@ static PyTypeObject *AugStore_type;
static PyTypeObject *Param_type;
static PyTypeObject *slice_type;
static PyObject* ast2obj_slice(void*);
static PyTypeObject *Ellipsis_type;
static PyTypeObject *Slice_type;
static char *Slice_fields[]={
"lower",
@ -530,6 +530,8 @@ static int init_types(void)
if (!Num_type) return 0;
Str_type = make_type("Str", expr_type, Str_fields, 1);
if (!Str_type) return 0;
Ellipsis_type = make_type("Ellipsis", expr_type, NULL, 0);
if (!Ellipsis_type) return 0;
Attribute_type = make_type("Attribute", expr_type, Attribute_fields, 3);
if (!Attribute_type) return 0;
Subscript_type = make_type("Subscript", expr_type, Subscript_fields, 3);
@ -570,8 +572,6 @@ static int init_types(void)
slice_type = make_type("slice", AST_type, NULL, 0);
if (!slice_type) return 0;
if (!add_attributes(slice_type, NULL, 0)) return 0;
Ellipsis_type = make_type("Ellipsis", slice_type, NULL, 0);
if (!Ellipsis_type) return 0;
Slice_type = make_type("Slice", slice_type, Slice_fields, 3);
if (!Slice_type) return 0;
ExtSlice_type = make_type("ExtSlice", slice_type, ExtSlice_fields, 1);
@ -1578,6 +1578,21 @@ Str(string s, int lineno, int col_offset, PyArena *arena)
return p;
}
expr_ty
Ellipsis(int lineno, int col_offset, PyArena *arena)
{
expr_ty p;
p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
if (!p) {
PyErr_NoMemory();
return NULL;
}
p->kind = Ellipsis_kind;
p->lineno = lineno;
p->col_offset = col_offset;
return p;
}
expr_ty
Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int lineno, int
col_offset, PyArena *arena)
@ -1720,19 +1735,6 @@ Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena
return p;
}
slice_ty
Ellipsis(PyArena *arena)
{
slice_ty p;
p = (slice_ty)PyArena_Malloc(arena, sizeof(*p));
if (!p) {
PyErr_NoMemory();
return NULL;
}
p->kind = Ellipsis_kind;
return p;
}
slice_ty
Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena)
{
@ -2515,6 +2517,10 @@ ast2obj_expr(void* _o)
goto failed;
Py_DECREF(value);
break;
case Ellipsis_kind:
result = PyType_GenericNew(Ellipsis_type, NULL, NULL);
if (!result) goto failed;
break;
case Attribute_kind:
result = PyType_GenericNew(Attribute_type, NULL, NULL);
if (!result) goto failed;
@ -2648,10 +2654,6 @@ ast2obj_slice(void* _o)
}
switch (o->kind) {
case Ellipsis_kind:
result = PyType_GenericNew(Ellipsis_type, NULL, NULL);
if (!result) goto failed;
break;
case Slice_kind:
result = PyType_GenericNew(Slice_type, NULL, NULL);
if (!result) goto failed;
@ -3059,6 +3061,8 @@ init_ast(void)
if (PyDict_SetItemString(d, "Call", (PyObject*)Call_type) < 0) return;
if (PyDict_SetItemString(d, "Num", (PyObject*)Num_type) < 0) return;
if (PyDict_SetItemString(d, "Str", (PyObject*)Str_type) < 0) return;
if (PyDict_SetItemString(d, "Ellipsis", (PyObject*)Ellipsis_type) < 0)
return;
if (PyDict_SetItemString(d, "Attribute", (PyObject*)Attribute_type) <
0) return;
if (PyDict_SetItemString(d, "Subscript", (PyObject*)Subscript_type) <
@ -3077,8 +3081,6 @@ init_ast(void)
return;
if (PyDict_SetItemString(d, "Param", (PyObject*)Param_type) < 0) return;
if (PyDict_SetItemString(d, "slice", (PyObject*)slice_type) < 0) return;
if (PyDict_SetItemString(d, "Ellipsis", (PyObject*)Ellipsis_type) < 0)
return;
if (PyDict_SetItemString(d, "Slice", (PyObject*)Slice_type) < 0) return;
if (PyDict_SetItemString(d, "ExtSlice", (PyObject*)ExtSlice_type) < 0)
return;

View File

@ -399,6 +399,9 @@ set_context(expr_ty e, expr_context_ty ctx, const node *n)
case Str_kind:
expr_name = "literal";
break;
case Ellipsis_kind:
expr_name = "Ellipsis";
break;
case Compare_kind:
expr_name = "comparison";
break;
@ -1213,6 +1216,9 @@ ast_for_atom(struct compiling *c, const node *n)
PyArena_AddPyObject(c->c_arena, pynum);
return Num(pynum, LINENO(n), n->n_col_offset, c->c_arena);
}
case DOT:
/* Ellipsis */
return Ellipsis(LINENO(n), n->n_col_offset, c->c_arena);
case LPAR: /* some parenthesized expressions */
ch = CHILD(n, 1);
@ -1308,13 +1314,10 @@ ast_for_slice(struct compiling *c, const node *n)
REQ(n, subscript);
/*
subscript: '.' '.' '.' | test | [test] ':' [test] [sliceop]
subscript: test | [test] ':' [test] [sliceop]
sliceop: ':' [test]
*/
ch = CHILD(n, 0);
if (TYPE(ch) == DOT)
return Ellipsis(c->c_arena);
if (NCH(n) == 1 && TYPE(ch) == test) {
/* 'step' variable hold no significance in terms of being used over
other vars */

View File

@ -2746,6 +2746,8 @@ static int
expr_constant(expr_ty e)
{
switch (e->kind) {
case Ellipsis_kind:
return 1;
case Num_kind:
return PyObject_IsTrue(e->v.Num.n);
case Str_kind:
@ -2977,6 +2979,9 @@ compiler_visit_expr(struct compiler *c, expr_ty e)
case Str_kind:
ADDOP_O(c, LOAD_CONST, e->v.Str.s, consts);
break;
case Ellipsis_kind:
ADDOP_O(c, LOAD_CONST, Py_Ellipsis, consts);
break;
/* The following exprs can be assignment targets. */
case Attribute_kind:
if (e->v.Attribute.ctx != AugStore)
@ -3255,9 +3260,6 @@ compiler_visit_nested_slice(struct compiler *c, slice_ty s,
expr_context_ty ctx)
{
switch (s->kind) {
case Ellipsis_kind:
ADDOP_O(c, LOAD_CONST, Py_Ellipsis, consts);
break;
case Slice_kind:
return compiler_slice(c, s, ctx);
case Index_kind:
@ -3284,12 +3286,6 @@ compiler_visit_slice(struct compiler *c, slice_ty s, expr_context_ty ctx)
VISIT(c, expr, s->v.Index.value);
}
break;
case Ellipsis_kind:
kindname = "ellipsis";
if (ctx != AugStore) {
ADDOP_O(c, LOAD_CONST, Py_Ellipsis, consts);
}
break;
case Slice_kind:
kindname = "slice";
if (!s->v.Slice.step)

View File

@ -1209,25 +1209,26 @@ static state states_59[4] = {
{1, arcs_59_2},
{1, arcs_59_3},
};
static arc arcs_60_0[6] = {
static arc arcs_60_0[7] = {
{13, 1},
{142, 2},
{145, 3},
{19, 4},
{148, 4},
{149, 5},
{74, 6},
};
static arc arcs_60_1[3] = {
{42, 6},
{141, 6},
{42, 7},
{141, 7},
{15, 4},
};
static arc arcs_60_2[2] = {
{143, 7},
{143, 8},
{144, 4},
};
static arc arcs_60_3[2] = {
{146, 8},
{146, 9},
{147, 4},
};
static arc arcs_60_4[1] = {
@ -1238,16 +1239,22 @@ static arc arcs_60_5[2] = {
{0, 5},
};
static arc arcs_60_6[1] = {
{15, 4},
{74, 10},
};
static arc arcs_60_7[1] = {
{144, 4},
{15, 4},
};
static arc arcs_60_8[1] = {
{144, 4},
};
static arc arcs_60_9[1] = {
{147, 4},
};
static state states_60[9] = {
{6, arcs_60_0},
static arc arcs_60_10[1] = {
{74, 4},
};
static state states_60[11] = {
{7, arcs_60_0},
{3, arcs_60_1},
{2, arcs_60_2},
{2, arcs_60_3},
@ -1256,6 +1263,8 @@ static state states_60[9] = {
{1, arcs_60_6},
{1, arcs_60_7},
{1, arcs_60_8},
{1, arcs_60_9},
{1, arcs_60_10},
};
static arc arcs_61_0[1] = {
{26, 1},
@ -1381,41 +1390,32 @@ static state states_65[3] = {
{2, arcs_65_1},
{2, arcs_65_2},
};
static arc arcs_66_0[3] = {
{74, 1},
{26, 2},
{21, 3},
static arc arcs_66_0[2] = {
{26, 1},
{21, 2},
};
static arc arcs_66_1[1] = {
{74, 4},
static arc arcs_66_1[2] = {
{21, 2},
{0, 1},
};
static arc arcs_66_2[2] = {
{21, 3},
static arc arcs_66_2[3] = {
{26, 3},
{154, 4},
{0, 2},
};
static arc arcs_66_3[3] = {
{26, 5},
{154, 6},
static arc arcs_66_3[2] = {
{154, 4},
{0, 3},
};
static arc arcs_66_4[1] = {
{74, 6},
{0, 4},
};
static arc arcs_66_5[2] = {
{154, 6},
{0, 5},
};
static arc arcs_66_6[1] = {
{0, 6},
};
static state states_66[7] = {
{3, arcs_66_0},
{1, arcs_66_1},
{2, arcs_66_2},
{3, arcs_66_3},
static state states_66[5] = {
{2, arcs_66_0},
{2, arcs_66_1},
{3, arcs_66_2},
{2, arcs_66_3},
{1, arcs_66_4},
{2, arcs_66_5},
{1, arcs_66_6},
};
static arc arcs_67_0[1] = {
{21, 1},
@ -1753,11 +1753,11 @@ static state states_82[3] = {
};
static dfa dfas[83] = {
{256, "single_input", 0, 3, states_0,
"\004\050\014\000\000\000\200\012\236\202\201\054\001\004\001\000\030\102\062\010\010"},
"\004\050\014\000\000\000\200\012\236\206\201\054\001\004\001\000\030\102\062\010\010"},
{257, "file_input", 0, 2, states_1,
"\204\050\014\000\000\000\200\012\236\202\201\054\001\004\001\000\030\102\062\010\010"},
"\204\050\014\000\000\000\200\012\236\206\201\054\001\004\001\000\030\102\062\010\010"},
{258, "eval_input", 0, 3, states_2,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\004\001\000\030\102\062\000\000"},
"\000\040\010\000\000\000\000\000\000\004\000\000\000\004\001\000\030\102\062\000\000"},
{259, "decorator", 0, 7, states_3,
"\000\010\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,
@ -1773,13 +1773,13 @@ static dfa dfas[83] = {
{265, "fplist", 0, 3, states_9,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{266, "stmt", 0, 2, states_10,
"\000\050\014\000\000\000\200\012\236\202\201\054\001\004\001\000\030\102\062\010\010"},
"\000\050\014\000\000\000\200\012\236\206\201\054\001\004\001\000\030\102\062\010\010"},
{267, "simple_stmt", 0, 4, states_11,
"\000\040\010\000\000\000\200\012\236\202\001\000\000\004\001\000\030\102\062\000\010"},
"\000\040\010\000\000\000\200\012\236\206\001\000\000\004\001\000\030\102\062\000\010"},
{268, "small_stmt", 0, 2, states_12,
"\000\040\010\000\000\000\200\012\236\202\001\000\000\004\001\000\030\102\062\000\010"},
"\000\040\010\000\000\000\200\012\236\206\001\000\000\004\001\000\030\102\062\000\010"},
{269, "expr_stmt", 0, 6, states_13,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\004\001\000\030\102\062\000\000"},
"\000\040\010\000\000\000\000\000\000\004\000\000\000\004\001\000\030\102\062\000\000"},
{270, "augassign", 0, 2, states_14,
"\000\000\000\000\000\370\177\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{271, "print_stmt", 0, 9, states_15,
@ -1837,69 +1837,69 @@ static dfa dfas[83] = {
{297, "except_clause", 0, 5, states_41,
"\000\000\000\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000"},
{298, "suite", 0, 5, states_42,
"\004\040\010\000\000\000\200\012\236\202\001\000\000\004\001\000\030\102\062\000\010"},
"\004\040\010\000\000\000\200\012\236\206\001\000\000\004\001\000\030\102\062\000\010"},
{299, "testlist_safe", 0, 5, states_43,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\004\001\000\030\102\062\000\000"},
"\000\040\010\000\000\000\000\000\000\004\000\000\000\004\001\000\030\102\062\000\000"},
{300, "old_test", 0, 2, states_44,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\004\001\000\030\102\062\000\000"},
"\000\040\010\000\000\000\000\000\000\004\000\000\000\004\001\000\030\102\062\000\000"},
{301, "old_lambdef", 0, 5, states_45,
"\000\000\000\000\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000"},
{302, "test", 0, 6, states_46,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\004\001\000\030\102\062\000\000"},
"\000\040\010\000\000\000\000\000\000\004\000\000\000\004\001\000\030\102\062\000\000"},
{303, "or_test", 0, 2, states_47,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\000\001\000\030\102\062\000\000"},
"\000\040\010\000\000\000\000\000\000\004\000\000\000\000\001\000\030\102\062\000\000"},
{304, "and_test", 0, 2, states_48,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\000\001\000\030\102\062\000\000"},
"\000\040\010\000\000\000\000\000\000\004\000\000\000\000\001\000\030\102\062\000\000"},
{305, "not_test", 0, 3, states_49,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\000\001\000\030\102\062\000\000"},
"\000\040\010\000\000\000\000\000\000\004\000\000\000\000\001\000\030\102\062\000\000"},
{306, "comparison", 0, 2, states_50,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\030\102\062\000\000"},
"\000\040\010\000\000\000\000\000\000\004\000\000\000\000\000\000\030\102\062\000\000"},
{307, "comp_op", 0, 4, states_51,
"\000\000\000\000\000\000\000\000\000\000\000\020\000\000\371\003\000\000\000\000\000"},
{308, "expr", 0, 2, states_52,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\030\102\062\000\000"},
"\000\040\010\000\000\000\000\000\000\004\000\000\000\000\000\000\030\102\062\000\000"},
{309, "xor_expr", 0, 2, states_53,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\030\102\062\000\000"},
"\000\040\010\000\000\000\000\000\000\004\000\000\000\000\000\000\030\102\062\000\000"},
{310, "and_expr", 0, 2, states_54,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\030\102\062\000\000"},
"\000\040\010\000\000\000\000\000\000\004\000\000\000\000\000\000\030\102\062\000\000"},
{311, "shift_expr", 0, 2, states_55,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\030\102\062\000\000"},
"\000\040\010\000\000\000\000\000\000\004\000\000\000\000\000\000\030\102\062\000\000"},
{312, "arith_expr", 0, 2, states_56,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\030\102\062\000\000"},
"\000\040\010\000\000\000\000\000\000\004\000\000\000\000\000\000\030\102\062\000\000"},
{313, "term", 0, 2, states_57,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\030\102\062\000\000"},
"\000\040\010\000\000\000\000\000\000\004\000\000\000\000\000\000\030\102\062\000\000"},
{314, "factor", 0, 3, states_58,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\030\102\062\000\000"},
"\000\040\010\000\000\000\000\000\000\004\000\000\000\000\000\000\030\102\062\000\000"},
{315, "power", 0, 4, states_59,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\100\062\000\000"},
{316, "atom", 0, 9, states_60,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\100\062\000\000"},
"\000\040\010\000\000\000\000\000\000\004\000\000\000\000\000\000\000\100\062\000\000"},
{316, "atom", 0, 11, states_60,
"\000\040\010\000\000\000\000\000\000\004\000\000\000\000\000\000\000\100\062\000\000"},
{317, "listmaker", 0, 5, states_61,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\004\001\000\030\102\062\000\000"},
"\000\040\010\000\000\000\000\000\000\004\000\000\000\004\001\000\030\102\062\000\000"},
{318, "testlist_gexp", 0, 5, states_62,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\004\001\000\030\102\062\000\000"},
"\000\040\010\000\000\000\000\000\000\004\000\000\000\004\001\000\030\102\062\000\000"},
{319, "lambdef", 0, 5, states_63,
"\000\000\000\000\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000"},
{320, "trailer", 0, 7, states_64,
"\000\040\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\100\000\000\000"},
{321, "subscriptlist", 0, 3, states_65,
"\000\040\050\000\000\000\000\000\000\004\000\000\000\004\001\000\030\102\062\000\000"},
{322, "subscript", 0, 7, states_66,
{322, "subscript", 0, 5, states_66,
"\000\040\050\000\000\000\000\000\000\004\000\000\000\004\001\000\030\102\062\000\000"},
{323, "sliceop", 0, 3, states_67,
"\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{324, "exprlist", 0, 3, states_68,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\030\102\062\000\000"},
"\000\040\010\000\000\000\000\000\000\004\000\000\000\000\000\000\030\102\062\000\000"},
{325, "testlist", 0, 3, states_69,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\004\001\000\030\102\062\000\000"},
"\000\040\010\000\000\000\000\000\000\004\000\000\000\004\001\000\030\102\062\000\000"},
{326, "dictsetmaker", 0, 8, states_70,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\004\001\000\030\102\062\000\000"},
"\000\040\010\000\000\000\000\000\000\004\000\000\000\004\001\000\030\102\062\000\000"},
{327, "classdef", 0, 8, states_71,
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\010\000"},
{328, "arglist", 0, 8, states_72,
"\000\040\010\060\000\000\000\000\000\000\000\000\000\004\001\000\030\102\062\000\000"},
"\000\040\010\060\000\000\000\000\000\004\000\000\000\004\001\000\030\102\062\000\000"},
{329, "argument", 0, 4, states_73,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\004\001\000\030\102\062\000\000"},
"\000\040\010\000\000\000\000\000\000\004\000\000\000\004\001\000\030\102\062\000\000"},
{330, "list_iter", 0, 2, states_74,
"\000\000\000\000\000\000\000\000\000\000\200\010\000\000\000\000\000\000\000\000\000"},
{331, "list_for", 0, 6, states_75,
@ -1913,7 +1913,7 @@ static dfa dfas[83] = {
{335, "gen_if", 0, 4, states_79,
"\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000"},
{336, "testlist1", 0, 2, states_80,
"\000\040\010\000\000\000\000\000\000\000\000\000\000\004\001\000\030\102\062\000\000"},
"\000\040\010\000\000\000\000\000\000\004\000\000\000\004\001\000\030\102\062\000\000"},
{337, "encoding_decl", 0, 2, states_81,
"\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{338, "yield_expr", 0, 3, states_82,

View File

@ -1161,6 +1161,7 @@ symtable_visit_expr(struct symtable *st, expr_ty e)
break;
case Num_kind:
case Str_kind:
case Ellipsis_kind:
/* Nothing to do here. */
break;
/* The following exprs can be assignment targets. */
@ -1365,8 +1366,6 @@ symtable_visit_slice(struct symtable *st, slice_ty s)
case Index_kind:
VISIT(st, expr, s->v.Index.value)
break;
case Ellipsis_kind:
break;
}
return 1;
}

View File

@ -58,7 +58,6 @@ Getattr: expr, attrname*
CallFunc: node, args!, star_args& = None, dstar_args& = None
Keyword: name*, expr
Subscript: expr, flags*, subs!
Ellipsis:
Sliceobj: nodes!
Slice: expr, flags*, lower&, upper&
Assert: test, fail&