Skip to content


Problem with multiline strings #24

davidkhess opened this Issue · 3 comments

2 participants


First of all, thanks for slimit! Nice tool.

Ran into a bug with multiline strings. If you provide this input:

var a = " \

You get this traceback:

Illegal character '"'
Illegal character '\\'
Illegal character '"'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/databakery/deployments/deployment-development/virtualenv/lib/python2.6/site-packages/slimit/", line 38, in minify
    tree = parser.parse(text)
  File "/home/databakery/deployments/deployment-development/virtualenv/lib/python2.6/site-packages/slimit/", line 64, in parse
    return self.parser.parse(text, lexer=self.lexer, debug=debug)
  File "/home/databakery/deployments/deployment-development/virtualenv/lib/python2.6/site-packages/ply/", line 265, in parse
    return self.parseopt_notrack(input,lexer,debug,tracking,tokenfunc)
  File "/home/databakery/deployments/deployment-development/virtualenv/lib/python2.6/site-packages/ply/", line 1047, in parseopt_notrack
    tok = self.errorfunc(errtoken)
  File "/home/databakery/deployments/deployment-development/virtualenv/lib/python2.6/site-packages/slimit/", line 84, in p_error
    self.lexer.prev_token, self.lexer.token())
SyntaxError: Unexpected token (SEMI, ';') at 1:13 between LexToken(LINE_TERMINATOR,'\n',1,11) and None
@rspivak rspivak was assigned

I'll look into it. Thanks again for reporting.


Hi David,

Took me a little bit longer than I anticipated but I've just committed the code to support multiline strings: 8839a01

Could you install SlimIt from the master branch and check if it solves the issue you had.



Closing for now

@rspivak rspivak closed this
@acatton acatton added a commit to acatton/slimit that referenced this issue
@rspivak Multiline string support - rspivak#24
Added support for JavaScript strings written across multiple lines
of code, as in:

var a = "hello \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.