summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2007-02-23 19:56:57 (GMT)
committerThomas Wouters <thomas@python.org>2007-02-23 19:56:57 (GMT)
commit00e41defe8801ef37548fb60abacb3be13156d2a (patch)
tree863d072e568fee2b8f4959016b5954de457c7f4c /Parser
parentcf297e46b85257396560774e5492e9d71a40f32e (diff)
downloadcpython-00e41defe8801ef37548fb60abacb3be13156d2a.zip
cpython-00e41defe8801ef37548fb60abacb3be13156d2a.tar.gz
cpython-00e41defe8801ef37548fb60abacb3be13156d2a.tar.bz2
Bytes literal.
Diffstat (limited to 'Parser')
-rw-r--r--Parser/Python.asdl1
-rw-r--r--Parser/tokenizer.c8
2 files changed, 9 insertions, 0 deletions
diff --git a/Parser/Python.asdl b/Parser/Python.asdl
index ea11349..fd47aa0 100644
--- a/Parser/Python.asdl
+++ b/Parser/Python.asdl
@@ -60,6 +60,7 @@ module Python version "$Revision$"
expr? starargs, expr? kwargs)
| Num(object n) -- a number as a PyObject.
| Str(string s) -- need to specify raw, unicode, etc?
+ | Bytes(string s)
| Ellipsis
-- other literals? bools?
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 84b7232..84bd60e 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -1244,6 +1244,14 @@ tok_get(register struct tok_state *tok, char **p_start, char **p_end)
if (c == '"' || c == '\'')
goto letter_quote;
break;
+ case 'b':
+ case 'B':
+ c = tok_nextc(tok);
+ if (c == 'r' || c == 'R')
+ c = tok_nextc(tok);
+ if (c == '"' || c == '\'')
+ goto letter_quote;
+ break;
}
while (isalnum(c) || c == '_') {
c = tok_nextc(tok);