-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
"Expected: :" error in ExtendScript #1144
Comments
There's no such compression option. But if you want to add parens to the consequent of a conditional here's the UglifyJS2 patch:
If you have the same issue with the ternary alternative you'd incorporate a similar change with Without patch:
With the patch:
Since this patch makes the output larger it will not be incorporated into uglify. You should probably report this ExtendScript grammar bug to Adobe as it's not ECMAScript compliant. |
UglifyJS targets ECMAScript compliant engines. I'm sorry, this is not going to happen in the upstream, not even with a flag. Thanks for the report! |
Added patch from mishoo#1144 (comment). Fixes ````Expected: :```` error in ExtendScript.
I think this is a valid es 5.1 bug (at the side of the adobe interpreter), but I'll have to document the valid parser waterfall before looking for a fix (edit: which is fix their software). Edit: done
Eventually, very deep in the parse tree, an assignementExpression accepts a primaryExpression, which accepts |
Parentheses aren't a compress option, they are read once, converted to ast and inserted again at the output phase if needed (to avoid confusion). Compression is done in AST trees and since the relations there are clear, there is no need for semicolons in the trees themselves. |
Major JS engines and browsers accept the code without parens. ExtendScript has a bug. |
Yeah, they should fix their engines and meh I care too much about even that piece of closed software. |
I would be willing to re-open this if ExtendScript were a major engine currently in use. I've never of it except for 2 reports here. Does anyone know whether ExtendScript has significant (enough) market share to consider this? |
I use ExtendScript as well and ran into the same problem. {
if_return: false,
conditionals: false,
booleans: false,
comparisons: false
} I also suggest that we "fix" this by adding an option to UglifyJS. Making Adobe change something in ExtendScript and waiting for everyone to update is going to take many, many years. |
I'm trying to use Uglify to compress and obscure Adobe ExtendScript ( ES3 dialect of JS ) code. Uglify seems to strip parentheses in nested ternary expressions. ExtendScript can't understand this and throws an error:
Expected: :
.Input code:
Output code from
uglifyjs -b -c -o output.js -- input.js
:I'm aware how edge case this is, but it would be great if there was a compression option to keep the parentheses in for this scenario.
The text was updated successfully, but these errors were encountered: