Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with multiline strings #24

Closed
davidkhess opened this issue Mar 13, 2012 · 3 comments
Closed

Problem with multiline strings #24

davidkhess opened this issue Mar 13, 2012 · 3 comments
Assignees
Labels

Comments

@davidkhess
Copy link

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/minifier.py", line 38, in minify
    tree = parser.parse(text)
  File "/home/databakery/deployments/deployment-development/virtualenv/lib/python2.6/site-packages/slimit/parser.py", 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/yacc.py", 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/yacc.py", line 1047, in parseopt_notrack
    tok = self.errorfunc(errtoken)
  File "/home/databakery/deployments/deployment-development/virtualenv/lib/python2.6/site-packages/slimit/parser.py", 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
@ghost ghost assigned rspivak Mar 16, 2012
@rspivak
Copy link
Owner

rspivak commented Mar 16, 2012

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

@rspivak
Copy link
Owner

rspivak commented Apr 9, 2012

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.

Thanks

@rspivak
Copy link
Owner

rspivak commented Apr 17, 2012

Closing for now

@rspivak rspivak closed this as completed Apr 17, 2012
acatton pushed a commit to acatton/fork--rspivak--slimit that referenced this issue Jan 26, 2015
Added support for JavaScript strings written across multiple lines
of code, as in:

var a = "hello \
world";
metatoaster added a commit to metatoaster/calmjs.parse that referenced this issue Apr 22, 2018
- Actually provide line continuation in strings that complies to the
  specification, which the fix provided by rspivak/slimit#24 was
  problematic (breaks position tracking) and incomplete as it amounted
  to no more than a clumsy workaround (come on, duplicated regex code).
- Also provide the expected minified output that would strip out these
  line continuation fragments.
metatoaster added a commit to metatoaster/calmjs.parse that referenced this issue Apr 22, 2018
- Actually provide line continuation in strings that complies to the
  specification, which the fix provided by rspivak/slimit#24 was
  problematic (breaks position tracking) and incomplete as it amounted
  to no more than a clumsy workaround (come on, duplicated regex code).
- Also provide the expected minified output that would strip out these
  line continuation fragments.
metatoaster added a commit to metatoaster/calmjs.parse that referenced this issue Apr 22, 2018
- Actually provide line continuation in strings that complies to the
  specification, which the fix provided by rspivak/slimit#24 was
  problematic (breaks position tracking) and incomplete as it amounted
  to no more than a clumsy workaround (come on, duplicated regex code).
- Also provide the expected minified output that would strip out these
  line continuation fragments.
metatoaster added a commit to metatoaster/calmjs.parse that referenced this issue Apr 22, 2018
- Actually provide line continuation in strings that complies to the
  specification, which the fix provided by rspivak/slimit#24 was
  problematic (breaks position tracking) and incomplete as it amounted
  to no more than a clumsy workaround (come on, duplicated regex code).
- Also provide the expected minified output that would strip out these
  line continuation fragments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants