Created
December 8, 2011 08:09
-
-
Save yanolab/1446431 to your computer and use it in GitHub Desktop.
add unless stmt to pypy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r c62cca56f289 pypy/interpreter/pyparser/pytokenizer.py | |
--- a/pypy/interpreter/pyparser/pytokenizer.py Tue Dec 06 18:47:03 2011 +0900 | |
+++ b/pypy/interpreter/pyparser/pytokenizer.py Thu Dec 08 13:30:38 2011 +0900 | |
@@ -169,7 +169,7 @@ | |
if start == end: | |
raise TokenError("Unknown character", line, | |
lnum, start + 1, token_list) | |
- | |
+ bpos = pos | |
pos = end | |
token, initial = line[start:end], line[start] | |
if initial in numchars or \ | |
@@ -213,6 +213,11 @@ | |
token_list.append(tok) | |
last_comment = '' | |
elif initial in namechars: # ordinary name | |
+ if token == "unless": | |
+ line = line[:start] + "if not" + line[start + 6:] | |
+ pos = bpos | |
+ continue | |
+ | |
token_list.append((tokens.NAME, token, lnum, start, line)) | |
last_comment = '' | |
elif initial == '\\': # continued stmt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment