Skip to content

Fix lexer bug involving template literals #106

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

Merged
merged 1 commit into from
Sep 24, 2019
Merged

Conversation

rhendric
Copy link
Contributor

In any program where a } character occurred anywhere before a template
literal, the lexer was incorrectly tokenizing the } and all characters
up through the initial backquote as a template tail. By adding an
additional piece of state to the parser monad, the lexer now will only
recognize a TemplateMiddleToken or a TemplateTailToken if the parser is
expecting one.

Fixes #104.

In any program where a `}` character occurred anywhere before a template
literal, the lexer was incorrectly tokenizing the `}` and all characters
up through the initial backquote as a template tail. By adding an
additional piece of state to the parser monad, the lexer now will only
recognize a TemplateMiddleToken or a TemplateTailToken if the parser is
expecting one.
Copy link
Owner

@erikd erikd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

@erikd erikd merged commit 54fecb9 into erikd:new-ast Sep 24, 2019
@rhendric rhendric deleted the fix/104 branch September 25, 2019 03:02
@rhendric rhendric mentioned this pull request Sep 29, 2019
9 tasks
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

Successfully merging this pull request may close these issues.

strings with backticks are misrecognized as template literals
2 participants