musictheory / NilScript

Objective-C-style language superset of JavaScript with a tiny, simple runtime
Other
50 stars 5 forks source link

Esprima being hand-patched? #90

Closed IngwiePhoenix closed 8 years ago

IngwiePhoenix commented 8 years ago

I was just doing a little bit of research on JSX and other things alike and came across the fact, that Facebook forked esprima to introduce JSX to it - so, it basically became esprima-fb.

My first thought was, "Oh cool! I could fork OJ and see if it does JSX". Only to realize, that this was certainly not possible.

So I wanted to ask why you are using a copy of Esprima in lib/ that has been modified to understand OJ? Isn't it possible to extend esprima through it's exports instead? It just confused me, so I decided to ask. :)

iccir commented 8 years ago

It's not really possible to extend esprima via exports, which is why every language extension (including JSX with esprima-fb) forks it and hacks on the main esprima.js file :)

iccir commented 8 years ago

(Esprima 3 is being completely refactored and has a parser delegator, but both oj and JSX need to extend the tokenizer; hence, they will likely continue to be forks).

IngwiePhoenix commented 8 years ago

Ohh, I see! Now, that makes sense. :)

Thanks for the info!