Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit switches to the recently-published `wast` crate to parse `*.witx` file. The `wast` crate is intended to be a way to easily write recursive descent and composable parsers. It includes built-in parsers for all of `*.wat` and `*.wast` syntax, but only a few limited ones were used for `*.witx`, otherwise it's just the idioms that were used for the `Parse` trait and such! The hope here is that this can consolidate lexing/handling of s-expressions and simplify the parsing strategy as well. Eventually it's intended that `wast` is flexible enough to have built-in parsers for interface types as well! The crate was refactored slightly in implementing this change, prominently: * The `validate` pass is not baked into the `src/toplevel.rs` parsing. * The `src/toplevel.rs` parsing was simplified slightly to have only one recursive function for parsing includes. * All `*Syntax` data types now have a `'a` lifetime parameter and are consumed immediately on the stack frame while parsing. * `Location` is no longer manufactured while parsing, but rather it's created on-demand while the ast is being constructed. This required a small refactoring to have a `DocValidationScope` which carries metadata about the current file that was parsed to manufacture `Location`.
- Loading branch information