WebIDL2.js

Hi all,

just a quick note to tell you that I've written a completely new version 
of JS WebIDL parser. The previous version was a one-off hack that I 
wrote really quickly because I needed something, but that became used a 
fair bit more than I'd intended.

The new version is available at https://github.com/darobin/webidl2.js 
(all the useful content being currently in the develop branch). You can 
also install it with npm install webidl2.

Compare to the previous version this one is about 6x less code (which 
translates to 4x smaller minified or 2x smaller minizipped) and 4x 
faster. The test suite still needs a lot of work (which is why I'm not 
considering this to be final) but most importantly I believe this to be 
much more correct and to be up to date with features currently in the 
draft. It also has far better error reporting.

The parsing interface is simple. In node, you require it and call 
parse(idlSource) on that. In the browser it creates a global WebIDL2 
object on which to call that (I haven't run the TS in the browser yet).

The AST you get is very similar to the one you got in v1, but some 
adjustments have been made in order to be more systematic, and to map 
better to what's actually in the spec now.

So if you're using v1, I invite you to give v2 a ride and tell me how it 
goes.

-- 
Robin Berjon - http://berjon.com/ - @robinberjon

Received on Tuesday, 30 October 2012 17:25:40 UTC