-
Notifications
You must be signed in to change notification settings - Fork 94
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
Illegal character "'" at 1:35518 after LexToken(COMMA,',',1,35516) #57
Comments
agree and support this request. |
Just looked at this: it appears to be unable to handle a single character escape sequence if it is part of a function call. If you replace
with
Then it does the right thing. Seems like an easy enough bug, but my Python isn't good enough to figure out where in the lexer things are going wrong. |
For what it's worth, I use slimit in js2xml and I had to add a simple OR to the lexer's string literal regexes, It's probably not acurate, for example after reading http://mathiasbynens.be/notes/javascript-escapes#octal , but it works for me string = r"""
(?:
# double quoted string
(?:" # opening double quote
(?: [^"\\\n\r] # no \, line terminators or "
| \\[a-zA-Z!-\/:-@\[-`{-~] # or escaped characters
| \\x[0-9a-fA-F]{2} # or hex_escape_sequence
| \\u[0-9a-fA-F]{4} # or unicode_escape_sequence
)*? # zero or many times
(?: \\\n # multiline ?
(?:
[^"\\\n\r] # no \, line terminators or "
| \\[a-zA-Z!-\/:-@\[-`{-~] # or escaped characters
| \\x[0-9a-fA-F]{2} # or hex_escape_sequence
| \\u[0-9a-fA-F]{4} # or unicode_escape_sequence
)*? # zero or many times
)*
") # closing double quote
|
# single quoted string
(?:' # opening single quote
(?: [^'\\\n\r] # no \, line terminators or '
| \\[a-zA-Z!-\/:-@\[-`{-~] # or escaped characters
| \\x[0-9a-fA-F]{2} # or hex_escape_sequence
| \\u[0-9a-fA-F]{4} # or unicode_escape_sequence
)*? # zero or many times
(?: \\\n # multiline ?
(?:
[^'\\\n\r] # no \, line terminators or '
| \\[a-zA-Z!-\/:-@\[-`{-~] # or escaped characters
| \\x[0-9a-fA-F]{2} # or hex_escape_sequence
| \\u[0-9a-fA-F]{4} # or unicode_escape_sequence
)*? # zero or many times
)*
') # closing single quote
)
""" became: string = r"""
(?:
# double quoted string
(?:" # opening double quote
(?: [^"\\\n\r] # no \, line terminators or "
| \\[a-zA-Z!-\/:-@\[-`{-~] # or escaped characters
| \\\d{1,}
| \\x[0-9a-fA-F]{2} # or hex_escape_sequence
| \\u[0-9a-fA-F]{4} # or unicode_escape_sequence
)*? # zero or many times
(?: \\\n # multiline ?
(?:
[^"\\\n\r] # no \, line terminators or "
| \\[a-zA-Z!-\/:-@\[-`{-~] # or escaped characters
| \\\d{1,}
| \\x[0-9a-fA-F]{2} # or hex_escape_sequence
| \\u[0-9a-fA-F]{4} # or unicode_escape_sequence
)*? # zero or many times
)*
") # closing double quote
|
# single quoted string
(?:' # opening single quote
(?: [^'\\\n\r] # no \, line terminators or '
| \\[a-zA-Z!-\/:-@\[-`{-~] # or escaped characters
| \\\d{1,}
| \\x[0-9a-fA-F]{2} # or hex_escape_sequence
| \\u[0-9a-fA-F]{4} # or unicode_escape_sequence
)*? # zero or many times
(?: \\\n # multiline ?
(?:
[^'\\\n\r] # no \, line terminators or '
| \\[a-zA-Z!-\/:-@\[-`{-~] # or escaped characters
| \\\d{1,}
| \\x[0-9a-fA-F]{2} # or hex_escape_sequence
| \\u[0-9a-fA-F]{4} # or unicode_escape_sequence
)*? # zero or many times
)*
') # closing single quote
)
""" https://github.com/redapple/js2xml/blob/master/js2xml/lexer.py |
- Also note that the following issues were addressed, where applicable to the lexer or parser. - rspivak/slimit#52 - rspivak/slimit#54 - rspivak/slimit#57 - rspivak/slimit#59 - rspivak/slimit#62 - rspivak/slimit#65 - rspivak/slimit#70 - rspivak/slimit#73 - rspivak/slimit#79 - rspivak/slimit#81 - rspivak/slimit#82 - rspivak/slimit#90 - Will get the release out when I get some sleep.
- Turns out the fix provided didn't actually fix this exact case, only the standard octal was included. - Demonstrate with the code reported by rspivak/slimit#57, and provide the fix.
- Turns out the fix provided didn't actually fix this exact case, only the standard octal was included. - Demonstrate with the code reported by rspivak/slimit#57, and provide the fix.
slimit seems to be having trouble minifying bootstrap-datepicker.js
Results in:
The text was updated successfully, but these errors were encountered: