diff options
author | Georg Brandl <georg@python.org> | 2006-09-06 07:06:08 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-09-06 07:06:08 (GMT) |
commit | 52318d6215f9f9626d38a9b81b52d411dbbdb36a (patch) | |
tree | 72563f6321f9265fb9d77702ee729e68048bdd07 /Lib/compiler | |
parent | 7cae87ca7b0a3a7ce497cbd335c8ec82fe680476 (diff) | |
download | cpython-52318d6215f9f9626d38a9b81b52d411dbbdb36a.zip cpython-52318d6215f9f9626d38a9b81b52d411dbbdb36a.tar.gz cpython-52318d6215f9f9626d38a9b81b52d411dbbdb36a.tar.bz2 |
Patch #1550786: ellipsis literal.
Diffstat (limited to 'Lib/compiler')
-rw-r--r-- | Lib/compiler/ast.py | 13 | ||||
-rw-r--r-- | Lib/compiler/pycodegen.py | 3 | ||||
-rw-r--r-- | Lib/compiler/transformer.py | 8 |
3 files changed, 5 insertions, 19 deletions
diff --git a/Lib/compiler/ast.py b/Lib/compiler/ast.py index b06531f..0be36a4 100644 --- a/Lib/compiler/ast.py +++ b/Lib/compiler/ast.py @@ -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 diff --git a/Lib/compiler/pycodegen.py b/Lib/compiler/pycodegen.py index e0c3a10..83d0481 100644 --- a/Lib/compiler/pycodegen.py +++ b/Lib/compiler/pycodegen.py @@ -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: diff --git a/Lib/compiler/transformer.py b/Lib/compiler/transformer.py index 4f2107f..0ffb597 100644 --- a/Lib/compiler/transformer.py +++ b/Lib/compiler/transformer.py @@ -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) |