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

js parser accepts a single backtick as valid js #98

Closed
Adjective-Object opened this issue Jun 15, 2022 · 1 comment
Closed

js parser accepts a single backtick as valid js #98

Adjective-Object opened this issue Jun 15, 2022 · 1 comment

Comments

@Adjective-Object
Copy link

I would expect this to error, as it contains an unterminated string template literal.

ast, parseErr := js.Parse(parse.NewInputString("`"), js.Options{})

When run via node, it fails to parse

$ node
> eval('`')
Uncaught SyntaxError: Unexpected end of input

This was replicated against github.com/tdewolff/parse/v2 v2.5.29

If you can point me in the right direction, I can take a stab at fixing this!

@Adjective-Object Adjective-Object changed the title js parser accepts a single backtick js parser accepts a single backtick as valid js Jun 15, 2022
@tdewolff
Copy link
Owner

Thanks Max, and thanks for offering to fix it! I've actually already gone ahead and fixed it, including a better error message for unterminated string.

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

No branches or pull requests

2 participants