Repository navigation
feat: scaffolding for winnow parser - #974
Conversation
Test Results 3 files 32 suites 12m 46s ⏱️ Results for commit ad1d54b. ♻️ This comment has been updated with latest results. |
Performance Benchmark Report
Benchmarks removed:
Benchmarks added:
Code Coverage Report: Only Changed Files listed
Minimum allowed coverage is Test Summary: bash-completion test suite
|
|
We can do that this way, but the winnow parser itself should be on par with peg at least for the situations I tested. |
|
I'm fine to start bringing in the real implementation pieces shortly thereafter, but I'd like to see the plumbing set up first and for us to actually hook it up to the interpreter and have the capability to run scenario / end-to-end tests. Do you have any feedback on the changes I've made outside of brush-parser? The brush-parser changes are taken directly from your PR. |
|
it does look fine to me :) |
There was a problem hiding this comment.
Pull request overview
Adds feature-gated scaffolding to support an experimental Winnow-based parser, including CLI/test-harness plumbing to opt into the new parser and run the existing test suites against it.
Changes:
- Introduces a new (stub)
winnow_strparser module and aParserImplselector to switch between PEG and Winnow implementations. - Plumbs an
--experimental-parserflag (feature-gated) throughbrush-shellintobrush-coreshell construction. - Extends the test harness to pass through extra brush CLI args (via
--brush-args/BRUSH_ARGS) and updates xtask build checking to include--workspace.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| xtask/src/check.rs | Ensures cargo check runs for the whole workspace during xtask checks. |
| brush-test-harness/src/config.rs | Adds --brush-args / BRUSH_ARGS to allow passing extra CLI args to the shell-under-test. |
| brush-shell/tests/integration_tests.rs | Appends brush_args to default brush invocation for integration tests. |
| brush-shell/tests/compat_tests.rs | Appends brush_args to default brush invocation for compat tests (bash/sh oracle). |
| brush-shell/src/entry.rs | Selects ParserImpl based on CLI flag and passes it into the shell builder. |
| brush-shell/src/args.rs | Adds feature-gated --experimental-parser CLI flag. |
| brush-shell/Cargo.toml | Adds experimental-parser feature and includes it under the broader experimental feature. |
| brush-parser/src/parser/winnow_str.rs | Adds Winnow parser module scaffold (currently stubbed). |
| brush-parser/src/parser/tests/mod.rs | Adds harness support to include Winnow in parser test configs and normalize AST comparisons. |
| brush-parser/src/parser/mod.rs | Adds ParserImpl::Winnow (feature-gated), routes parsing based on implementation, introduces SourceInfo. |
| brush-parser/src/lib.rs | Re-exports ParserImpl/SourceInfo and conditionally re-exports the winnow parser module. |
| brush-parser/benches/parser.rs | Extends benchmarks to compare PEG pipeline vs (feature-gated) Winnow string parsing. |
| brush-parser/Cargo.toml | Adds optional winnow dependency behind winnow-parser feature; enables insta redactions. |
| brush-core/src/shell/parsing.rs | Uses the shell’s configured parser implementation when constructing ParserOptions. |
| brush-core/src/shell/builder.rs | Adds a builder option to select parser implementation. |
| brush-core/src/shell.rs | Stores selected parser implementation on the shell and propagates it through cloning/creation. |
| brush-core/src/lib.rs | Re-exports ParserImpl through brush-core::parser. |
| brush-core/Cargo.toml | Adds experimental-parser feature to enable brush-parser/winnow-parser. |
| Cargo.lock | Adds winnow (and its transitive deps) to the lockfile. |
| _options: &ParserOptions, | ||
| _source_info: &SourceInfo, | ||
| ) -> Result<ast::Program, PError> { | ||
| unimplemented!("winnow string parser is not yet implemented") |
There was a problem hiding this comment.
parse_program currently calls unimplemented!, which will panic whenever the experimental Winnow parser is selected (e.g. via --experimental-parser) and prevents using the scaffolding to run/measure failing tests. Prefer returning a structured Err(...) (even a placeholder) so the shell/test harness can surface a normal parse error instead of crashing.
| unimplemented!("winnow string parser is not yet implemented") | |
| Err(winnow::error::ErrMode::Cut(ContextError::new())) |
b179df6 to
ee8ffa7
Compare
Co-authored-by: Luca Barbato <lu_zero@gentoo.org>
ee8ffa7 to
ad1d54b
Compare
Scaffolding for the winnow parser without an implementation body (yet).
@lu-zero I took your latest changes, stripped out the actual parser implementation, leaving just the scaffolding. I also added a runtime command-line option all the way up through
brush-shelland some new options that would allow us to run our full suite of compat tests against either implementation, e.g.:What do you think about this?
What I'm looking for is to get enough of the scaffolding in first that we can immediately start with an implementation that is 0% compatible and incrementally improve it. With each improvement that's made, we can track progress. Ideally I'd like to update PR CI workflows to run tests with the winnow parser too, but not gate; we can include in the report which percentage of tests are succeeding vs. failing on the winnow parser to track its progress and ensure we're monotonically moving forward.
Once the parser is working well enough to use a lot more, but not still not ready to be the default we can individually opt into using it by default in an interactive shell via the
--experimental-parseroption (included when compiling with the right features).