mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-07 13:24:39 +08:00
Remove compatibility in parser for Python 2
This commit is contained in:
@@ -43,10 +43,8 @@ class Parser(BaseParser):
|
|||||||
# Not sure if this is the best idea, but IMO it's the easiest way to
|
# Not sure if this is the best idea, but IMO it's the easiest way to
|
||||||
# avoid extreme amounts of work around the subtle difference of 2/3
|
# avoid extreme amounts of work around the subtle difference of 2/3
|
||||||
# grammar in list comoprehensions.
|
# grammar in list comoprehensions.
|
||||||
'list_for': tree.SyncCompFor,
|
|
||||||
'decorator': tree.Decorator,
|
'decorator': tree.Decorator,
|
||||||
'lambdef': tree.Lambda,
|
'lambdef': tree.Lambda,
|
||||||
'old_lambdef': tree.Lambda,
|
|
||||||
'lambdef_nocond': tree.Lambda,
|
'lambdef_nocond': tree.Lambda,
|
||||||
}
|
}
|
||||||
default_node = tree.PythonNode
|
default_node = tree.PythonNode
|
||||||
@@ -96,12 +94,6 @@ class Parser(BaseParser):
|
|||||||
# ones and therefore have pseudo start/end positions and no
|
# ones and therefore have pseudo start/end positions and no
|
||||||
# prefixes. Just ignore them.
|
# prefixes. Just ignore them.
|
||||||
children = [children[0]] + children[2:-1]
|
children = [children[0]] + children[2:-1]
|
||||||
elif nonterminal == 'list_if':
|
|
||||||
# Make transitioning from 2 to 3 easier.
|
|
||||||
nonterminal = 'comp_if'
|
|
||||||
elif nonterminal == 'listmaker':
|
|
||||||
# Same as list_if above.
|
|
||||||
nonterminal = 'testlist_comp'
|
|
||||||
node = self.default_node(nonterminal, children)
|
node = self.default_node(nonterminal, children)
|
||||||
for c in children:
|
for c in children:
|
||||||
c.parent = node
|
c.parent = node
|
||||||
|
|||||||
Reference in New Issue
Block a user