mirror of
https://github.com/python/cpython.git
synced 2025-11-13 15:40:05 +00:00
Marc-Andre Lemburg: add new string token types u"..." and ur"..."
(Unicode and raw Unicode).
This commit is contained in:
parent
4aa1e63e4c
commit
86016cb482
1 changed files with 10 additions and 0 deletions
|
|
@ -591,12 +591,22 @@ PyTokenizer_Get(tok, p_start, p_end)
|
||||||
|
|
||||||
/* Identifier (most frequent token!) */
|
/* Identifier (most frequent token!) */
|
||||||
if (isalpha(c) || c == '_') {
|
if (isalpha(c) || c == '_') {
|
||||||
|
/* Process r"", u"" and ur"" */
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'r':
|
case 'r':
|
||||||
case 'R':
|
case 'R':
|
||||||
c = tok_nextc(tok);
|
c = tok_nextc(tok);
|
||||||
if (c == '"' || c == '\'')
|
if (c == '"' || c == '\'')
|
||||||
goto letter_quote;
|
goto letter_quote;
|
||||||
|
break;
|
||||||
|
case 'u':
|
||||||
|
case 'U':
|
||||||
|
c = tok_nextc(tok);
|
||||||
|
if (c == 'r' || c == 'R')
|
||||||
|
c = tok_nextc(tok);
|
||||||
|
if (c == '"' || c == '\'')
|
||||||
|
goto letter_quote;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
while (isalnum(c) || c == '_') {
|
while (isalnum(c) || c == '_') {
|
||||||
c = tok_nextc(tok);
|
c = tok_nextc(tok);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue