swiftwasm / WebAPIKit

Access the DOM and other Web APIs from Swift! (Very much a WIP)
MIT License
63 stars 8 forks source link

Initial attempt at spec downloading #5

Closed j-f1 closed 2 years ago

j-f1 commented 3 years ago

I started this in, like, September but never finished it. Current status:

Error: The following types are undefined:
    - LinkStyle
    - MediaSource
    - MediaStream
    - MouseEvent
    - MouseEventInit
    - SVGImageElement
    - SVGScriptElement
    - VisibilityState
    - WebGL2RenderingContext
    - WindowProxy
MaxDesiatov commented 3 years ago

I wonder if WebGL 1 and WebGL 2 IDL is overlapping. If not, we could apply codegen to both 🤔

j-f1 commented 3 years ago

I tried pulling in webgl 2 and it seems to depend on webgl 1. So it should be ok to pull it down.

j-f1 commented 3 years ago

Looks like the WebGL 1 spec uses a typedef inside an interface, which our parser doesn’t support

MaxDesiatov commented 3 years ago

Thanks for investigation! I saw that error, but wasn't sure where it's coming from. Would you have time for fixing the parser soon, or would you like me to tackle it?

j-f1 commented 3 years ago

If you want to you can but I’m pretty much free the whole week. Probably going to sign out for the night tho.

MaxDesiatov commented 3 years ago

I got some progress with the parser fix here in the meantime https://github.com/Apodini/webidl2swift/pull/12

MaxDesiatov commented 3 years ago

Looks like WebGL spec parsing isn't fixed with that PR, I'm adding source line diagnostics to the webidl2swift tokenizer/parser now anyway to investigate this properly...

j-f1 commented 2 years ago

I think this is the wrong approach. Instead, I’m going to try pulling the webidl2swift code into this repository, and taking advantage of the W3C’s official (JS-based) parser instead of using the hand-rolled Swift one.