rspivak / slimit

SlimIt - a JavaScript minifier/parser in Python
MIT License
550 stars 94 forks source link

Wrong tree on parsing array/string with special characters (EOL) #82

Open wizche opened 8 years ago

wizche commented 8 years ago

If parsing the following javascript:

var x = ['a','\n'];

The resulting Array node will contain only the 'a' field. image

Probably also related, when parsing var x = '\n'; the following exception is raised:

SyntaxError: Unexpected token (SEMI, ';') at 1:11 between LexToken(LINE_TERMINATOR,'\n',1,9) and None
-------------------- >> begin captured stdout << ---------------------
Illegal character "'" at 1:8 after LexToken(EQ,'=',1,6)
Illegal character "'" at 1:10 after LexToken(LINE_TERMINATOR,'\n',1,9)