darobin / webidl.js

DEPRECATED — Use https://github.com/darobin/webidl2.js instead
http://berjon.com/
26 stars 10 forks source link

support for webidl dictionaries, fix for primitive type bug, simpler parser generation #2

Closed davidflanagan closed 13 years ago

davidflanagan commented 13 years ago

Robin,

I've modified lib/grammar.peg to support the new dictionary type, to fix the primitve type bug where DOMStringList (e.g.) would not parse as an argument type, and to treat // comments as spaces so they don't need special handling.

The trickier thing to do was to get it working with current versions of node and pegjs. The code in utils/generate.js seemed to be manually patching the pegjs output in ways that were no longer necessary: pegjs has adopted the start token argument and the patches no longer seem necessary. Also lib/peg.js used a node API that is no longer supported. I removed both lib/peg.js and util/generate.js and replaced them with a simpler Makefile that just assumes you've installed pegjs with npm.

These fixes seem to do what I need, but I'm only using node/WebIDLParser.js. I haven't tested the new web/WebIDLParser.js code, so pull with caution.

darobin commented 13 years ago

This all looks good to me, thanks a lot! The only non-Node user that I know of for this is ReSpec v2 which is still quite confidential in use so I'm not too worried. Yes indeed, peg's changed quite a fair bit (for the better) since I first used it. Indeed I was manually patching its output because that was the only way to make it work and I couldn't get any feedback on changes. Good to see it's moving ahead.

Thanks again!