Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5026cb4

Browse files
committed
Now that the string-sig has settled on r"obin" strings, restrict the
<letter><string> notation to 'r' and 'R'.
1 parent c474dea commit 5026cb4

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

Parser/tokenizer.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -541,9 +541,13 @@ tok_get(tok, p_start, p_end)
541541

542542
/* Identifier (most frequent token!) */
543543
if (isalpha(c) || c == '_') {
544-
c = tok_nextc(tok);
545-
if (c == '"' || c == '\'')
546-
goto letter_quote;
544+
switch (c) {
545+
case 'r':
546+
case 'R':
547+
c = tok_nextc(tok);
548+
if (c == '"' || c == '\'')
549+
goto letter_quote;
550+
}
547551
while (isalnum(c) || c == '_') {
548552
c = tok_nextc(tok);
549553
}

0 commit comments

Comments
 (0)