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

Unexpected token ** when left operand is parenthesized unary expression #2069

Closed
luiscubal opened this issue Mar 8, 2021 · 1 comment
Closed

Comments

@luiscubal
Copy link

Steps to reproduce

Parse the following code:

esprima.parse('(-1) ** 2')

Expected output

The expression (-1) ** 2 is accepted by mainstream browsers as valid and I believe that Esprima should accept it as well.

Actual output

Esprima fails with the following error:

> esprima.parse('(-1)**2')
Uncaught Error: Line 1: Unexpected token **
<stack trace>

Relevant references

The reason for Esprima's failure is that it identifies "(-1) ** 2" as "-1 ** 2" which is indeed invalid.

@luiscubal
Copy link
Author

Nevermind, I think this is a duplicate of #1981

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant