rspivak / slimit

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

Minify fails on jquery file #109

Open Alexey-T opened 5 years ago

Alexey-T commented 5 years ago

I use latest GH version. I use CudaText plugin "JS Format" which is here https://github.com/cudatext-addons/cuda_js_format

Startup: total: 1040ms, including plugins: 90ms
Python 3.6.8
Loading toolbar config
Illegal character '"' at 1:6981 after LexToken(EQ,'=',1,6979)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/user/.config/cudatext/py/cuda_js_format/__init__.py", line 70, in minify
    format_proc.run(do_minify)
  File "/home/user/.config/cudatext/py/cuda_js_format/format_proc.py", line 83, in run
    text = do_format(text)
  File "/home/user/.config/cudatext/py/cuda_js_format/__init__.py", line 47, in do_minify
    return slimit.minify(text, mangle=True, mangle_toplevel=True)
  File "/home/user/.config/cudatext/py/cuda_js_format/slimit/minifier.py", line 38, in minify
    tree = parser.parse(text)
  File "/home/user/.config/cudatext/py/cuda_js_format/slimit/parser.py", line 93, in parse
    return self.parser.parse(text, lexer=self.lexer, debug=debug)
  File "/home/user/.config/cudatext/py/cuda_js_format/ply/yacc.py", line 333, in parse
    return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
  File "/home/user/.config/cudatext/py/cuda_js_format/ply/yacc.py", line 1201, in parseopt_notrack
    tok = call_errorfunc(self.errorfunc, errtoken, self)
  File "/home/user/.config/cudatext/py/cuda_js_format/ply/yacc.py", line 192, in call_errorfunc
    r = errorfunc(token)
  File "/home/user/.config/cudatext/py/cuda_js_format/slimit/parser.py", line 116, in p_error
    self._raise_syntax_error(token)
  File "/home/user/.config/cudatext/py/cuda_js_format/slimit/parser.py", line 89, in _raise_syntax_error
    self.lexer.prev_token, self.lexer.token())
SyntaxError: Unexpected token (CONDOP, '?') at 1:6983 between LexToken(LPAREN,'(',1,6982) and LexToken(COLON,':',1,6984)
Alexey-T commented 5 years ago

I minify this file jquery-3.4.1.full.zip