mirror of https://github.com/python/cpython
Get rid of some more cases of backquotes. parsermodule.c doesn't compile
but looks like that was a problem before this change.
This commit is contained in:
parent
3bd844e695
commit
2eca440c8d
|
@ -36,9 +36,6 @@
|
||||||
\lineiii{}{\member{expr}}{}
|
\lineiii{}{\member{expr}}{}
|
||||||
\hline
|
\hline
|
||||||
|
|
||||||
\lineiii{Backquote}{\member{expr}}{}
|
|
||||||
\hline
|
|
||||||
|
|
||||||
\lineiii{Bitand}{\member{nodes}}{}
|
\lineiii{Bitand}{\member{nodes}}{}
|
||||||
\hline
|
\hline
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ extern "C" {
|
||||||
#define EQUAL 22
|
#define EQUAL 22
|
||||||
#define DOT 23
|
#define DOT 23
|
||||||
#define PERCENT 24
|
#define PERCENT 24
|
||||||
#define BACKQUOTE 25
|
/* #define BACKQUOTE 25 */
|
||||||
#define LBRACE 26
|
#define LBRACE 26
|
||||||
#define RBRACE 27
|
#define RBRACE 27
|
||||||
#define EQEQUAL 28
|
#define EQEQUAL 28
|
||||||
|
|
|
@ -111,7 +111,6 @@ class Transformer:
|
||||||
self._atom_dispatch = {token.LPAR: self.atom_lpar,
|
self._atom_dispatch = {token.LPAR: self.atom_lpar,
|
||||||
token.LSQB: self.atom_lsqb,
|
token.LSQB: self.atom_lsqb,
|
||||||
token.LBRACE: self.atom_lbrace,
|
token.LBRACE: self.atom_lbrace,
|
||||||
token.BACKQUOTE: self.atom_backquote,
|
|
||||||
token.NUMBER: self.atom_number,
|
token.NUMBER: self.atom_number,
|
||||||
token.STRING: self.atom_string,
|
token.STRING: self.atom_string,
|
||||||
token.NAME: self.atom_name,
|
token.NAME: self.atom_name,
|
||||||
|
@ -740,9 +739,6 @@ class Transformer:
|
||||||
return Dict((), lineno=nodelist[0][2])
|
return Dict((), lineno=nodelist[0][2])
|
||||||
return self.com_dictsetmaker(nodelist[1])
|
return self.com_dictsetmaker(nodelist[1])
|
||||||
|
|
||||||
def atom_backquote(self, nodelist):
|
|
||||||
return Backquote(self.com_node(nodelist[1]))
|
|
||||||
|
|
||||||
def atom_number(self, nodelist):
|
def atom_number(self, nodelist):
|
||||||
### need to verify this matches compile.c
|
### need to verify this matches compile.c
|
||||||
k = eval(nodelist[0][1])
|
k = eval(nodelist[0][1])
|
||||||
|
|
|
@ -1564,7 +1564,7 @@ class Helper:
|
||||||
'CLASSES': ('ref/types', 'class SPECIALMETHODS PRIVATENAMES'),
|
'CLASSES': ('ref/types', 'class SPECIALMETHODS PRIVATENAMES'),
|
||||||
'MODULES': ('lib/typesmodules', 'import'),
|
'MODULES': ('lib/typesmodules', 'import'),
|
||||||
'PACKAGES': 'import',
|
'PACKAGES': 'import',
|
||||||
'EXPRESSIONS': ('ref/summary', 'lambda or and not in is BOOLEAN COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES LISTS DICTIONARIES BACKQUOTES'),
|
'EXPRESSIONS': ('ref/summary', 'lambda or and not in is BOOLEAN COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES LISTS DICTIONARIES'),
|
||||||
'OPERATORS': 'EXPRESSIONS',
|
'OPERATORS': 'EXPRESSIONS',
|
||||||
'PRECEDENCE': 'EXPRESSIONS',
|
'PRECEDENCE': 'EXPRESSIONS',
|
||||||
'OBJECTS': ('ref/objects', 'TYPES'),
|
'OBJECTS': ('ref/objects', 'TYPES'),
|
||||||
|
@ -1587,14 +1587,13 @@ class Helper:
|
||||||
'IDENTIFIERS': ('ref/identifiers', 'keywords SPECIALIDENTIFIERS'),
|
'IDENTIFIERS': ('ref/identifiers', 'keywords SPECIALIDENTIFIERS'),
|
||||||
'SPECIALIDENTIFIERS': ('ref/id-classes', ''),
|
'SPECIALIDENTIFIERS': ('ref/id-classes', ''),
|
||||||
'PRIVATENAMES': ('ref/atom-identifiers', ''),
|
'PRIVATENAMES': ('ref/atom-identifiers', ''),
|
||||||
'LITERALS': ('ref/atom-literals', 'STRINGS BACKQUOTES NUMBERS TUPLELITERALS LISTLITERALS DICTIONARYLITERALS'),
|
'LITERALS': ('ref/atom-literals', 'STRINGS NUMBERS TUPLELITERALS LISTLITERALS DICTIONARYLITERALS'),
|
||||||
'TUPLES': 'SEQUENCES',
|
'TUPLES': 'SEQUENCES',
|
||||||
'TUPLELITERALS': ('ref/exprlists', 'TUPLES LITERALS'),
|
'TUPLELITERALS': ('ref/exprlists', 'TUPLES LITERALS'),
|
||||||
'LISTS': ('lib/typesseq-mutable', 'LISTLITERALS'),
|
'LISTS': ('lib/typesseq-mutable', 'LISTLITERALS'),
|
||||||
'LISTLITERALS': ('ref/lists', 'LISTS LITERALS'),
|
'LISTLITERALS': ('ref/lists', 'LISTS LITERALS'),
|
||||||
'DICTIONARIES': ('lib/typesmapping', 'DICTIONARYLITERALS'),
|
'DICTIONARIES': ('lib/typesmapping', 'DICTIONARYLITERALS'),
|
||||||
'DICTIONARYLITERALS': ('ref/dict', 'DICTIONARIES LITERALS'),
|
'DICTIONARYLITERALS': ('ref/dict', 'DICTIONARIES LITERALS'),
|
||||||
'BACKQUOTES': ('ref/string-conversions', 'repr str STRINGS LITERALS'),
|
|
||||||
'ATTRIBUTES': ('ref/attribute-references', 'getattr hasattr setattr ATTRIBUTEMETHODS'),
|
'ATTRIBUTES': ('ref/attribute-references', 'getattr hasattr setattr ATTRIBUTEMETHODS'),
|
||||||
'SUBSCRIPTS': ('ref/subscriptions', 'SEQUENCEMETHODS1'),
|
'SUBSCRIPTS': ('ref/subscriptions', 'SEQUENCEMETHODS1'),
|
||||||
'SLICINGS': ('ref/slicings', 'SEQUENCEMETHODS2'),
|
'SLICINGS': ('ref/slicings', 'SEQUENCEMETHODS2'),
|
||||||
|
|
|
@ -35,7 +35,6 @@ GREATER = 21
|
||||||
EQUAL = 22
|
EQUAL = 22
|
||||||
DOT = 23
|
DOT = 23
|
||||||
PERCENT = 24
|
PERCENT = 24
|
||||||
BACKQUOTE = 25
|
|
||||||
LBRACE = 26
|
LBRACE = 26
|
||||||
RBRACE = 27
|
RBRACE = 27
|
||||||
EQEQUAL = 28
|
EQEQUAL = 28
|
||||||
|
|
|
@ -2404,11 +2404,6 @@ validate_atom(node *tree)
|
||||||
if (res && (nch == 3))
|
if (res && (nch == 3))
|
||||||
res = validate_dictmaker(CHILD(tree, 1));
|
res = validate_dictmaker(CHILD(tree, 1));
|
||||||
break;
|
break;
|
||||||
case BACKQUOTE:
|
|
||||||
res = ((nch == 3)
|
|
||||||
&& validate_testlist1(CHILD(tree, 1))
|
|
||||||
&& validate_ntype(CHILD(tree, 2), BACKQUOTE));
|
|
||||||
break;
|
|
||||||
case NAME:
|
case NAME:
|
||||||
case NUMBER:
|
case NUMBER:
|
||||||
res = (nch == 1);
|
res = (nch == 1);
|
||||||
|
|
Loading…
Reference in New Issue