Skip to content

Commit f4dd644

Browse files
committed
address review: lowercase and move invalid rule
1 parent e525b8f commit f4dd644

9 files changed

Lines changed: 209 additions & 209 deletions

File tree

‎Grammar/python.gram‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -815,13 +815,6 @@ in_bitwise_or[CmpopExprPair*]: 'in' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, I
815815
isnot_bitwise_or[CmpopExprPair*]: 'is' 'not' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, IsNot, a) }
816816
is_bitwise_or[CmpopExprPair*]: 'is' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, Is, a) }
817817

818-
invalid_noteq:
819-
| a='<' b='>' {
820-
_PyPegen_tokens_are_adjacent(a, b)
821-
? RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "invalid syntax. Maybe you meant '!=' instead of '<>'?")
822-
: NULL
823-
}
824-
825818
# Bitwise operators
826819
# -----------------
827820

@@ -1667,3 +1660,10 @@ invalid_bitwise_or:
16671660
? RAISE_SYNTAX_ERROR_KNOWN_RANGE(b, c, "invalid syntax. Maybe you meant 'or' or '|' instead of '||'?")
16681661
: NULL
16691662
}
1663+
1664+
invalid_noteq:
1665+
| a='<' b='>' {
1666+
_PyPegen_tokens_are_adjacent(a, b)
1667+
? RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "invalid syntax. Maybe you meant '!=' instead of '<>'?")
1668+
: NULL
1669+
}

‎Parser/action_helpers.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2076,7 +2076,7 @@ _PyPegen_checked_from_import(Parser *p, asdl_seq *dots, expr_ty module_name,
20762076
alias_ty alias = asdl_seq_GET(names, i);
20772077
if (PyUnicode_CompareWithASCIIString(alias->name, "barry_as_FLUFL") == 0) {
20782078
p->flags |= PyPARSE_BARRY_AS_BDFL;
2079-
p->tok->BARRY_AS_BDFL = 1;
2079+
p->tok->barry_as_bdfl = 1;
20802080
}
20812081
}
20822082
}

‎Parser/lexer/lexer.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ _PyLexer_get_normal_mode(struct tok_state *tok, tokenizer_mode* current_tok, str
562562
/* Check for two-character token */
563563
{
564564
int c2 = tok_nextc(tok);
565-
int current_token = _PyToken_TwoChars(c, c2, tok->BARRY_AS_BDFL);
565+
int current_token = _PyToken_TwoChars(c, c2, tok->barry_as_bdfl);
566566
if (current_token != OP) {
567567
int c3 = tok_nextc(tok);
568568
int current_token3 = _PyToken_ThreeChars(c, c2, c3);

‎Parser/lexer/state.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ _PyTokenizer_tok_new(void)
6363
#ifdef Py_DEBUG
6464
tok->debug = _Py_GetConfig()->parser_debug;
6565
#endif
66-
tok->BARRY_AS_BDFL = 0;
66+
tok->barry_as_bdfl = 0;
6767
return tok;
6868
}
6969

‎Parser/lexer/state.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ struct tok_state {
137137
#ifdef Py_DEBUG
138138
int debug;
139139
#endif
140-
int BARRY_AS_BDFL;
140+
int barry_as_bdfl;
141141
};
142142

143143
int _PyLexer_type_comment_token_setup(struct tok_state *tok, struct token *token, int type, int col_offset,

0 commit comments

Comments
 (0)