Closed bobrippling closed 1 day ago
@gfwilliams this PR assumes we can parse all syntaxes from the 2020 edition
... but I don't think that's the case (e.g. destructuring isn't supported), so I have two questions:
sanitycheck
which then fail to parse on-device? Or vice-versa, we only enable ??
parsing and possibly other things espruino supports (based on the above list)Is there a list anywhere of what's supported and what isn't?
https://www.espruino.com/Features
I guess ideally it'd be really nice to throw errors for unsupported stuff. Is there a 'visitor' for acorn maybe, so we can iterate over everything in the syntax tree and check for unsupported stuff that gets parsed (eg spread I guess)?
I've gone with upgrading to 8.0 which lets acorn parse ??
without an extra dependency, at the price of having to specify an ecma version. A visitor would be ideal but I'm afraid I don't have capacity atm (happy to close this for now to keep the PRs clear)
Thanks! No I'm fine if you want to merge this - I guess the Lint config (or something in espruinotools) should ideally be the one to catch it anyway.
Cool, sounds good - I suppose there's existing constructs that are parsed but not warned about too, so the lint config does sound like the right approach (e.g. destructuring)
Thanks! I think this should probably be in https://github.com/espruino/EspruinoTools (which the IDE as well as BangleApps uses). We could then use the tools themselves (there is some commented out code in https://github.com/espruino/BangleApps/blob/master/bin/sanitycheck.js#L565-L573) to parse which could check for supported constructs as well as potentially some other things (like libraries that don't exist)
Ah, so the tools can accurately tell if the JS will be parsed by espruino? That's cool
To help with PRs such as #3642