* In WASM, use a custom, simple malloc implementation that lets us
expicitly reset the heap with a new start location.
* When a WASM call traps or errors, propagate that as a parse failure.
* Reset the WASM heap after every parse.
Co-authored-by: Conrad <conrad@zed.dev>
This allows users to build parsers without having to run `test` or
`parse` to invoke the compilation process, and allows them to output the
object file to wherever they like. The `build-wasm` command was merged
into this by just specifying the `--wasm` flag.
Changed the build-wasm command to always use forward slashes in paths,
since using Windows style paths breaks if the build is run with Docker.
Fixes#532
This patch updates the CLI to use anyhow and thiserror for error
management. The main feature that our custom `Error` type was providing
was a _list_ of messages, which would allow us to annotate "lower-level"
errors with more contextual information. This is exactly what's
provided by anyhow's `Context` trait.
(This is setup work for a future PR that will pull the `config` and
`loader` modules out into separate crates; by using `anyhow` we wouldn't
have to deal with a circular dependency between with the new crates.)
This is necessary on systems with SELinux to prevent file permission/access errors when building WASM output
* cli/src/wasm.rs: Use Z volume mount option for docker-run
* script/build-wasm: Likewise.
* Check that docker is on the PATH before trying to run it
* Don't try to use id(1) if using docker on windows
* Add error message if neither emcc nor docker are available
Fixes#358