Skip to content

Conversation

@hhugo
Copy link
Member

@hhugo hhugo commented May 3, 2020

Before this PR, the js lexer was trying to adjust its production based on the previous token.

  • INCR vs INCR_NB ("NB" stands for "No line Break")
  • DECR vs DECR_NB
  • DIV vs DIV_ASSIGN vs REGEXP

The lexer was also populating the fol (first of line) field that was later used by Js_parser.Lexer.adjust_token and the js parser for semicolon automatic insertion.

Using the incremental API of menhir (where the control flow is inverted), we can now remove all theses hacks and move all the logic inside parser_aux.

This also has the advantage of being much more friendly with the stack when running in javascript (jsoo toplevel)

@hhugo
Copy link
Member Author

hhugo commented May 3, 2020

fyi @let-def

@hhugo hhugo requested a review from TyOverby May 3, 2020 05:09
@let-def
Copy link
Contributor

let-def commented May 3, 2020

Cool!

@TyOverby
Copy link
Collaborator

TyOverby commented May 3, 2020

Is the goal with this PR to allow for better regexp parsing?

@hhugo
Copy link
Member Author

hhugo commented May 3, 2020

This PR allows us to parse regexp literal correctly and in a much cleaner way.

@hhugo hhugo added this to the 3.7 milestone May 5, 2020
@hhugo hhugo merged commit 76c5000 into master May 6, 2020
@hhugo hhugo deleted the parserjs branch May 6, 2020 20:43
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.

4 participants