summaryrefslogtreecommitdiff
path: root/sqlparse/lexer.py
diff options
context:
space:
mode:
authorquest <quest@wonky.windwards.net>2012-04-21 20:28:49 +0200
committerquest <quest@wonky.windwards.net>2012-04-21 20:28:49 +0200
commit61f22063051fa94b0f055a995eed10b576535c29 (patch)
treedcc1de1b1ad4b8bd27cd8524cbe8c9cd714e0c90 /sqlparse/lexer.py
parent13274ebb0d66b64363145bf23b6aa824845f61be (diff)
downloadsqlparse-61f22063051fa94b0f055a995eed10b576535c29.tar.gz
Minor clarifications and doc updates
Diffstat (limited to 'sqlparse/lexer.py')
-rw-r--r--sqlparse/lexer.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/sqlparse/lexer.py b/sqlparse/lexer.py
index 82a6169..a0ce5d2 100644
--- a/sqlparse/lexer.py
+++ b/sqlparse/lexer.py
@@ -279,6 +279,7 @@ class Lexer(object):
m = rexmatch(text, pos)
if m:
if hasmore and m.end() == len(text):
+ # Since this is end, token may be truncated
continue
# print rex.pattern
@@ -315,13 +316,14 @@ class Lexer(object):
statetokens = tokendefs[statestack[-1]]
break
else:
+ if hasmore:
+ buf = self._decode(stream.read(self.bufsize))
+ hasmore = len(buf) == self.bufsize
+ text = text[pos:] + buf
+ pos = 0
+ continue
+
try:
- if hasmore:
- buf = self._decode(stream.read(self.bufsize))
- hasmore = len(buf) == self.bufsize
- text = text[pos:] + buf
- pos = 0
- continue
if text[pos] == '\n':
# at EOL, reset state to "root"
pos += 1