diff options
author | Armin Ronacher <armin.ronacher@active-4.com> | 2012-03-04 12:04:06 (GMT) |
---|---|---|
committer | Armin Ronacher <armin.ronacher@active-4.com> | 2012-03-04 12:04:06 (GMT) |
commit | 6ecf77b3f8c981a695d4116b010755676bcc61e2 (patch) | |
tree | 6d8f597f8fd2796f997a814d6d20092dc9344398 /Parser | |
parent | 745ccf8b1a5d5ee8d8a72b17ebaa0bc5533b0fed (diff) | |
download | cpython-6ecf77b3f8c981a695d4116b010755676bcc61e2.zip cpython-6ecf77b3f8c981a695d4116b010755676bcc61e2.tar.gz cpython-6ecf77b3f8c981a695d4116b010755676bcc61e2.tar.bz2 |
Basic support for PEP 414 without docs or tests.
Diffstat (limited to 'Parser')
-rw-r--r-- | Parser/tokenizer.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index 55f4313..36ca079 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -1412,11 +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"", br"" and rb"" */ - int saw_b = 0, saw_r = 0; + /* Process b"", r"", u"", br"", rb"" and ur"" */ + int saw_b = 0, saw_r = 0, saw_u = 0; while (1) { - if (!saw_b && (c == 'b' || c == 'B')) + if (!(saw_b || saw_u) && (c == 'b' || c == 'B')) saw_b = 1; + /* Since this is a backwards compatibility support literal we don't + want to support it in arbitrary order like byte literals. */ + else if (!(saw_b || saw_u || saw_r) && (c == 'u' || c == 'U')) + saw_u = 1; else if (!saw_r && (c == 'r' || c == 'R')) saw_r = 1; else |