Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nextest-filtering] Replace nom parser with winnow #1214

Merged
merged 49 commits into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
d9ad3f9
[nextest-filtering] Simplify transition by decoupling callers from no…
epage Jan 8, 2024
ff3fc0c
[nextest-filtering] Simplify callers by centralizing state construction
epage Jan 8, 2024
30c7428
[nextest-filtering] Prepare for transition by adding no-op traces
epage Jan 8, 2024
96cafb2
[nextest-filtering] Migrate to winnow 0.3
epage Jan 8, 2024
670d274
[nextest-filtering] Stop masquerading as nom
epage Jan 8, 2024
340570a
[nextest-filtering] Simplify transition by switching from FnMut to Pa…
epage Dec 8, 2023
fe70004
[nextest-filtering] Replace deprecated Err with ErrMode
epage Jan 8, 2024
e1c0c8b
[nextest-filtering] Simplify by removing 'tag', where possible
epage Jan 8, 2024
d7cdbb9
[nextest-filtering] Remove deprecated 'char', where possible
epage Jan 8, 2024
62a488b
[nextest-filtering] Remove use of deprecated 'pair'
epage Jan 8, 2024
9c2abe2
[nextest-filtering] Replace deprecated `complete::tag` with `tag`
epage Jan 8, 2024
f6a16ac
[nextest-filtering] Replace deprecated 'char' with 'one_of'
epage Jan 8, 2024
dfa3ef4
[nextest-filtering] Replace deprecated 'take_till' with 'take_till0'
epage Jan 8, 2024
79d0ef6
[nextest-filtering] Remove superfluous closure for take_till0
epage Jan 9, 2024
eaabd99
[nextest-filtering] Replace deprecated `complete::` parsers
epage Jan 9, 2024
321ba9c
[nextest-filtering] Replace deprecated 'is_not' with 'take_till1'
epage Jan 9, 2024
c3dadbe
[nextest-filtering] Remove redundant use of 'recognize'
epage Jan 9, 2024
9bce79c
[nextest-filtering] Replace deprecated `verify` with trait method
epage Jan 9, 2024
72fb9c7
[nextest-filtering] Replace deprecated 'map' with trait method
epage Jan 9, 2024
f6e473a
[nextest-filtering] Replace depredcated 'verify_map' with trait method
epage Jan 9, 2024
4aa38fa
[nextest-filtering] Replace deprecated 'map_res' with trait method
epage Jan 9, 2024
b5a55af
[nextest-filtering] Replace deprecated 'value' with trait method
epage Jan 9, 2024
ff268ef
[nextest-filtering] Prepare for 0.4's use of `impl Parser` over `impl…
epage Jan 9, 2024
ed53b86
[nextest-filtering] Upgrade to winnow 0.4
epage Jan 9, 2024
eadbeb9
[nextest-filtering] Replace deprecated mods
epage Jan 9, 2024
aa594eb
[nextest-filtering] Replace deprecated 'take_while_m_n' with more gen…
epage Jan 9, 2024
34d050d
[nextest-filtering] Replace deprecated 'many0' with more general form
epage Jan 9, 2024
96fd0ab
[nextest-filtering] Replace deprecated 'fold_many0' with more general…
epage Jan 9, 2024
7ad2cf0
[nextest-filtering] Replace deprecated 'Parser::map_res' with 'Parser…
epage Jan 9, 2024
4947e51
[nextest-filtering] Simplify by removing 'tag'/'one_of', where possible
epage Jan 9, 2024
955192f
[nextest-filtering] Replace deprecated 'Error' with 'InputError'
epage Jan 9, 2024
ccdd936
[nextest-filetring] Replace deprecated, slow string sets
epage Dec 11, 2023
d905aea
[nextest-filtering] Simplify transition by splitting out 'new_span' call
epage Jan 9, 2024
37d6cf1
[nextest-filtering] Simplify transition to 0.5 with 'unpeek'
epage Jan 9, 2024
84c585f
[nextest-filtering] Upgrade to winnow 0.5
epage Jan 9, 2024
905ef8a
[nextest-filtering] Replace deprecated 'take_till*' with more general…
epage Jan 9, 2024
7a16741
[nextest-filtering] Refactor parse_glob into a parser generator
epage Jan 9, 2024
0c43306
[nextest-filtering] Remove unpeek from parse_glob
epage Jan 9, 2024
5948651
[nextest-filtering] Simplify by removing 'run_str_parser'
epage Jan 9, 2024
9cba57a
[nextest-filtering] Remove unpeek from unicode parsing
epage Jan 9, 2024
16292d0
[nextest-filtering] Update tests to new parser style
epage Jan 9, 2024
3e65786
[nextest-filtering] Make functions parsers again
epage Jan 10, 2024
8fc7f90
[nextest-filtering] Remove remaining uses of unpeek
epage Jan 10, 2024
d95964a
[nextest-filtering] Reduce need for input cloning
epage Jan 10, 2024
82f7590
[nextest-filtering] Simplify the Error type
epage Jan 10, 2024
b93a38e
[nextest-filtering] Remove use of `RefCell`
epage Jan 10, 2024
b9adb36
[nextest-filtering] Address clippy lints
epage Jan 10, 2024
f05ea08
[nextest-filtering] Address rustfmt style
epage Jan 10, 2024
72d2fe6
Merge branch 'main' into winnow
sunshowers Jan 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 25 additions & 76 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions nextest-filtering/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ internal-testing = ["dep:proptest", "dep:test-strategy", "dep:twox-hash"]
globset.workspace = true
guppy = "0.17.4"
miette = "5.10.0"
nom = "7.1.3"
nom-tracable = "0.9.1"
nom_locate = "4.2.0"
recursion = "0.5.2"
regex = "1.10.2"
regex-syntax = "0.8.2"
Expand All @@ -41,6 +38,7 @@ proptest = { version = "1.4.0", optional = true }
test-strategy = { version = "0.3.1", optional = true }
twox-hash = { version = "1.6.3", optional = true }
nextest-workspace-hack.workspace = true
winnow = "0.5.34"

[dev-dependencies]
clap = { version = "4.4.18", features = ["derive"] }
Expand Down
32 changes: 6 additions & 26 deletions nextest-filtering/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// SPDX-License-Identifier: MIT OR Apache-2.0

use miette::{Diagnostic, SourceSpan};
use nom_tracable::TracableInfo;
use std::cell::RefCell;
use thiserror::Error;

/// A set of errors that occurred while parsing a filter expression.
Expand Down Expand Up @@ -151,37 +149,19 @@
RegexError(String),
}

#[derive(Debug, Clone)]
#[derive(Debug)]

Check warning on line 152 in nextest-filtering/src/errors.rs

View check run for this annotation

Codecov / codecov/patch

nextest-filtering/src/errors.rs#L152

Added line #L152 was not covered by tests
pub(crate) struct State<'a> {
// A `RefCell` is required here because the state must implement `Clone` to work with nom.
errors: &'a RefCell<Vec<ParseSingleError>>,
tracable_info: TracableInfo,
errors: &'a mut Vec<ParseSingleError>,
}

impl<'a> State<'a> {
pub fn new(errors: &'a RefCell<Vec<ParseSingleError>>) -> Self {
let tracable_info = nom_tracable::TracableInfo::new()
.forward(true)
.backward(true);
Self {
errors,
tracable_info,
}
}

pub fn report_error(&self, error: ParseSingleError) {
self.errors.borrow_mut().push(error);
}
}

impl<'a> nom_tracable::HasTracableInfo for State<'a> {
fn get_tracable_info(&self) -> TracableInfo {
self.tracable_info.get_tracable_info()
pub fn new(errors: &'a mut Vec<ParseSingleError>) -> Self {
Self { errors }
}

fn set_tracable_info(mut self, info: TracableInfo) -> Self {
self.tracable_info = self.tracable_info.set_tracable_info(info);
self
pub fn report_error(&mut self, error: ParseSingleError) {
self.errors.push(error);
}
}

Expand Down
Loading