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

Accessing .default in object crashes Slimit. #59

Open
Luke-SF opened this issue Oct 19, 2013 · 0 comments
Open

Accessing .default in object crashes Slimit. #59

Luke-SF opened this issue Oct 19, 2013 · 0 comments

Comments

@Luke-SF
Copy link

Luke-SF commented Oct 19, 2013

Slimit crashes when trying to minify anything that tries to get a reference to .default. As a workaround, you can access it with object['default'].

>>> slimit.minify("var a={b:'b', c:'c', default:'def'}; console.log(a.default)")

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\slimit\minifier.py", line 38, in minify
    tree = parser.parse(text)
  File "C:\Python27\lib\site-packages\slimit\parser.py", line 93, in parse
    return self.parser.parse(text, lexer=self.lexer, debug=debug)
  File "C:\Python27\lib\site-packages\ply\yacc.py", line 265, in parse
    return self.parseopt_notrack(input,lexer,debug,tracking,tokenfunc)
  File "C:\Python27\lib\site-packages\ply\yacc.py", line 1047, in parseopt_notra
ck
    tok = self.errorfunc(errtoken)
  File "C:\Python27\lib\site-packages\slimit\parser.py", line 116, in p_error
    self._raise_syntax_error(token)
  File "C:\Python27\lib\site-packages\slimit\parser.py", line 89, in _raise_synt
ax_error
    self.lexer.prev_token, self.lexer.token())
SyntaxError: Unexpected token (DEFAULT, 'default') at 1:21 between LexToken(COMM
A,',',1,19) and LexToken(COLON,':',1,28)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant