[pypy-svn] r16517 - pypy/dist/pypy/interpreter/pyparser
ale at codespeak.net
ale at codespeak.net
Thu Aug 25 18:19:23 CEST 2005
Author: ale
Date: Thu Aug 25 18:19:22 2005
New Revision: 16517
Modified:
pypy/dist/pypy/interpreter/pyparser/pythonlexer.py
Log:
(arre, ale)
Detect unterminated single quoted strings.
Adjust line number in an error
Modified: pypy/dist/pypy/interpreter/pyparser/pythonlexer.py
==============================================================================
--- pypy/dist/pypy/interpreter/pyparser/pythonlexer.py (original)
+++ pypy/dist/pypy/interpreter/pyparser/pythonlexer.py Thu Aug 25 18:19:22 2005
@@ -124,7 +124,7 @@
if contstr: # continued string
if not line:
raise TokenError("EOF while scanning triple-quoted string", line,
- (lnum, 0), token_list)
+ (lnum-1, 0), token_list)
endmatch = endDFA.recognize(line)
if endmatch >= 0:
pos = end = endmatch
@@ -277,6 +277,12 @@
token_list.append((tok, line, lnum, pos))
last_comment = ''
else:
+ start = whiteSpaceDFA.recognize(line, pos)
+ if start < 0:
+ start = pos
+ if start<max and line[start] in single_quoted:
+ raise TokenError("EOL while scanning single-quoted string", line,
+ (lnum, start), token_list)
tok = Token(pytoken.ERRORTOKEN, line[pos])
token_list.append((tok, line, lnum, pos))
last_comment = ''
More information about the Pypy-commit
mailing list