From a7aba40790cfa881f825ff5ae35fb2ad775b9c5f Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 7 Oct 2011 00:42:31 +0200 Subject: [PATCH] fix a bug where the js tokenizer would fail if the last character of the source was an operator --- ox/js.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ox/js.py b/ox/js.py index 36c08f2..eac2d0f 100644 --- a/ox/js.py +++ b/ox/js.py @@ -125,10 +125,11 @@ def tokenize(source): cursor += 1 elif char in OPERATOR: type = 'operator' - string = char + source[cursor] - while cursor < length and string in OPERATOR: - cursor += 1 - string += source[cursor] + if cursor < length: + string = char + source[cursor] + while cursor < length and string in OPERATOR: + cursor += 1 + string += source[cursor] elif char in STRING: type = 'string' while cursor < length and source[cursor] != source[start]: