This commit is contained in:
Jeremy Ashkenas 2011-09-20 23:21:46 -05:00
parent 65b3bf0d4c
commit 3d91b10927
3 changed files with 10 additions and 2 deletions

View File

@ -347,6 +347,7 @@
}
}
if (value === ';') {
this.seenFor = false;
tag = 'TERMINATOR';
} else if (__indexOf.call(MATH, value) >= 0) {
tag = 'MATH';

View File

@ -329,7 +329,9 @@ exports.Lexer = class Lexer
prev[0] = 'COMPOUND_ASSIGN'
prev[1] += '='
return value.length
if value is ';' then tag = 'TERMINATOR'
if value is ';'
@seenFor = no
tag = 'TERMINATOR'
else if value in MATH then tag = 'MATH'
else if value in COMPARE then tag = 'COMPARE'
else if value in COMPOUND_ASSIGN then tag = 'COMPOUND_ASSIGN'

View File

@ -201,7 +201,12 @@ test "#1630: `in` should check `hasOwnProperty`", ->
ok undefined not in length: 1
test "#1714: lexer bug with raw range `for` followed by `in`", ->
0 for [1..10]
0 for [1..2]
ok not ('a' in ['b'])
0 for [1..2]; ok not ('a' in ['b'])
0 for [1..10] # comment ending
ok not ('a' in ['b'])