erikd / language-javascript

Parser for JavaScript, in Haskell
BSD 3-Clause "New" or "Revised" License
160 stars 47 forks source link

Support for ECMAScript 6 and 7 #71

Open erikd opened 6 years ago

erikd commented 6 years ago

This implements features for es 6 & 7.

Each of these should be implemented in a separate PR and each item needs tests. There are likely to be three tests needed, one for the appropriate XParser.hs test and one in each if Minify.hs and RoundTrip.hs.

erikd commented 6 years ago

const was already supported and let as added in PR #72.

erikd commented 6 years ago

Support for the spread operator was added in #73.

erikd commented 6 years ago

Arrow expressions were added in #74.

Cmdv commented 6 years ago

@erikd would it be ok to work on import and export individually? I spotted the work was done in the original big PR. Just don't want to do it if you are already working on it 😄

erikd commented 6 years ago

Absolutely fine.

Unfortunately, I have not done much more than merge patches for some time.

hdgarrood commented 5 years ago

I'd like to pick up where @Cmdv left off on import parsing.

fare commented 5 years ago

Also missing, it seems:

kl0tl commented 5 years ago

Support for unparenthesized single-argument arrow functions was added in https://github.com/erikd/language-javascript/pull/90 and export for function declarations in https://github.com/erikd/language-javascript/pull/88.

jeapostrophe commented 5 years ago

const [a, b] = f(); is not supported. It should be easy to just change the VariableDeclaration case to allow ArrayLiteral

edit: I updated to the last checkout and I think it is now supported.

rhendric commented 5 years ago

I knocked off a bunch of the outstanding ES7 items in some work that's now released in 0.6.0.14:

ronyhe commented 4 years ago

Hi all, I'd like to contribute some work here, but I'm unfamiliar with the ! syntax in the AST module: https://github.com/erikd/language-javascript/blob/38e48dd49ccea05675515e8323c0e0035ff97bea/src/Language/JavaScript/Parser/AST.hs#L55 Can someone please refer me to an article/explanation? Thanks in advance!

erikd commented 4 years ago

Its a strictness annotation. See eg: https://wiki.haskell.org/Performance/Strictness

georgefst commented 1 year ago

Any reason to stop at ES7? I'm personally missing ?? and ?.