Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [wtp-dev] JSDT Parser

Angelo,

Yes, sure, I used that option. The problem is that esprima actually throws a lot of syntax exceptions:

grep -c throwUnexpectedToken esprima.js
56
grep -c tolerateUnexpectedToken esprima.js
29

That means that in 2/3 error cases it throws exception and tolerate only 1/3. Shift meanwhile doesn't throws exceptions
in "Early Error" cases like this 0=0, which is tolerated by esprima. I have a suspicion that most of esprima
"tolerated errors" are from that "Early Error" category, which means that in fact Shift behaves like esprima :-)

I thought that it would be interesting to compare shift and esprima behavior on large enough set of erroneous code
fragments. It might happen that they are very close actually :-)


> I'm not a big expert with esprima, but do you use tolerant option like explained at http://esprima.org/doc/ ?

> 2016-03-12 10:25 GMT+01:00 Eugene Melekhov <emvv@xxxxxxx>:

> Angelo,
>  
>  One more thing about parser tolerance. esprima for example throws an exception parsing this "relatively simple"
>  declarations:
>  
>  //function foo(a, b {}
>  
>  //function foo(a, b, c,) {}
>  
>  //function foo(a, b, {} {}
>  
>  
 >> Yes sure, but it seems that Shift doesn't support tolerant parser which is very required for a JS editor. See https://github.com/shapesecurity/shift-java/issues/93
>  
>  
>  
> --
>  Eugene Melekhov
>  
>  _______________________________________________
>  wtp-dev mailing list
>  wtp-dev@xxxxxxxxxxx
>  To change your delivery options, retrieve your password, or unsubscribe from this list, visit
>  https://dev.eclipse.org/mailman/listinfo/wtp-dev
>  




-- 
Eugene Melekhov



Back to the top