summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-01-12 21:46:19 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-01-12 21:46:19 (GMT)
commit3a5d4cb940d9f06505b0b65916fd9a844bed13e3 (patch)
tree4f76dccee7b943c2d421442240892fe711401053 /Parser
parentb63a450cc4c69c4e8668aa434a37b2aa213e94e0 (diff)
downloadcpython-3a5d4cb940d9f06505b0b65916fd9a844bed13e3.zip
cpython-3a5d4cb940d9f06505b0b65916fd9a844bed13e3.tar.gz
cpython-3a5d4cb940d9f06505b0b65916fd9a844bed13e3.tar.bz2
Issue #13748: Raw bytes literals can now be written with the `rb` prefix as well as `br`.
Diffstat (limited to 'Parser')
-rw-r--r--Parser/tokenizer.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index c3b2f35..55f4313 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -1412,13 +1412,15 @@ tok_get(register struct tok_state *tok, char **p_start, char **p_end)
/* Identifier (most frequent token!) */
nonascii = 0;
if (is_potential_identifier_start(c)) {
- /* Process b"", r"" and br"" */
- if (c == 'b' || c == 'B') {
- c = tok_nextc(tok);
- if (c == '"' || c == '\'')
- goto letter_quote;
- }
- if (c == 'r' || c == 'R') {
+ /* Process b"", r"", br"" and rb"" */
+ int saw_b = 0, saw_r = 0;
+ while (1) {
+ if (!saw_b && (c == 'b' || c == 'B'))
+ saw_b = 1;
+ else if (!saw_r && (c == 'r' || c == 'R'))
+ saw_r = 1;
+ else
+ break;
c = tok_nextc(tok);
if (c == '"' || c == '\'')
goto letter_quote;