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

'yield' parsed as keyword instead of identifier #1918

Open
PetarMax opened this Issue Mar 8, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@PetarMax

PetarMax commented Mar 8, 2018

In the file src/scanner.ts, in the function isKeyword, yield is treated as a keyword, which is incorrect. This should be handled by the function nextToken() in src/parser.ts, where there already exists an appropriate test for strictness and reserved words in strict mode.

Steps to reproduce

esprima.parseScript('yield : 1')

Expected output

Valid syntax tree.

Actual output

Error: Line 1: Unexpected token :

Relevant references

https://www.ecma-international.org/ecma-262/8.0/index.html#sec-strict-mode-of-ecmascript states that yield is a keyword only in strict mode.

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