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

ES2015 (ES6) support #15

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

ES2015 (ES6) support #15

wants to merge 12 commits into from

Conversation

metatoaster
Copy link
Member

@metatoaster metatoaster commented Apr 21, 2018

Currently just started so this is a complete work in progress. Absolutely no ETA at the moment because I can only spare hobby level time to work on this.

A very rough outline of what needs to be done

  • Lexer
  • Parser
  • Unparser (pretty printing)
  • Ruletypes and other handlers that may be required

@mrdeveloperdude
Copy link

mrdeveloperdude commented Sep 3, 2021

Wow can I just say this is awesome! This work should receive way more attention because it is super important!

metatoaster and others added 10 commits October 9, 2021 14:56
- Provide support of the spread operator and arrow function, along with
  naive support of the template literal.

  - The template literal currently does NOT have awareness of available
    identifiers and the like, it's just a dumb string with a funny quote
    for this initial implementation.

- Contains fixes to the regex rules introduced in commits authored later
  than the initial author date of this commit.
- Implement the lookahead and properly check the newlines.
- However, that whole escape sequence check might have to be done
  _inside_ the token formation as this is still going to fail valid
  input templates such as `foo \ bar` when it will reduce to effectively
  `foo  bar`, rather than a syntax error.  Likewise for string literals.
- Mark the generated tokens with the appropriate types.
- Use an excess of extra tokens relevant to this particular syntax.
- This is basically identical to the ES5 parser at this point, with the
  references modify to reflect the ES2015 intent that this parser will
  handle.
- Additional changes since the initial cut have been squashed into this
  commit to match as close to the current implementation and tests,
  including:

  - Fix to disambiguation of DIV vs. REGEX lexer tokens.
- The parser can now parse template literals from tokens produced by the
  lexer and produce the ast with the new asttypes for templates.
- Initial set of test cases included, however there are certain
  limitations which have been found that needed correction in the lexer
  itself.
- This must be done as templates can nest templates
- Not to mention the fact that objects can be provided as values.  Given
  they share the RBRACE symbol, there needs to be a way to disambiguate
  that symbol for objects and the opening of the template middle/tail
  fragments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants