Skip to content

Commit

Permalink
feat: combinator based parser
Browse files Browse the repository at this point in the history
ci: test all parsers
  • Loading branch information
desbma-s1n committed Jun 3, 2024
1 parent bd6b6b5 commit 3a3ab1c
Show file tree
Hide file tree
Showing 7 changed files with 683 additions and 15 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,43 @@ env:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
strace-parser: [combinator, peg, regex]
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- run: cargo build --verbose
- run: cargo build --no-default-features --features strace-parser-${{matrix.strace-parser}} --verbose

test:
runs-on: ubuntu-latest
strategy:
matrix:
strace-parser: [combinator, peg, regex]
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- run: cargo test --bins --verbose
- run: cargo test --bins --no-default-features --features strace-parser-${{matrix.strace-parser}} --verbose

clippy:
runs-on: ubuntu-latest
strategy:
matrix:
strace-parser: [combinator, peg, regex]
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: clippy
- run: cargo clippy -- -D warnings
- run: cargo clippy --no-default-features --features strace-parser-${{matrix.strace-parser}} -- -D warnings

fmt:
runs-on: ubuntu-latest
Expand Down
33 changes: 33 additions & 0 deletions Cargo.lock

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

9 changes: 6 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ strip = true
anyhow = { version = "1.0.72", default-features = false, features = ["std", "backtrace"] }
bincode = { version = "1.3.3", default-features = false }
clap = { version = "4.3.17", default-features = false, features = ["std", "color", "help", "usage", "error-context", "suggestions", "derive"] }
function_name = { version = "0.3.0", default-features = false, optional = true }
itertools = { version = "0.11.0", default-features = false, features = ["use_std"] }
lazy_static = { version = "1.4.0", default-features = false }
log = { version = "0.4.19", default-features = false, features = ["max_level_trace", "release_max_level_info"] }
nix = { version = "0.26.2", default-features = false, features = ["fs"] }
nom = { version = "7.1.3", default-features = false, features = ["std"], optional = true }
pest = { version = "2.7.10", default-features = false, features = ["std", "memchr"], optional = true }
pest_derive = { version = "2.7.10", default-features = false, features = ["std", "grammar-extras"], optional = true}
rand = { version = "0.8.5", default-features = false, features = ["std", "std_rng"] }
Expand All @@ -37,11 +39,12 @@ predicates = { version = "3.0.3", default-features = false, features = ["color"]
pretty_assertions = { version = "1.4.0", default-features = false, features = ["std"] }

[features]
default = ["parser-peg"]
default = ["strace-parser-combinator"]
as-root = [] # for tests only
nightly = [] # for benchmarks only
parser-peg = ["dep:pest", "dep:pest_derive"]
parser-regex = []
strace-parser-combinator = ["dep:function_name", "dep:nom"]
strace-parser-peg = ["dep:pest", "dep:pest_derive"]
strace-parser-regex = []

[lints.rust]
missing_docs = "warn"
Expand Down
1 change: 1 addition & 0 deletions src/strace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pub enum Expression {
args: Vec<Expression>,
},
// Only used for strace pseudo macro invocations, see `test_macro_addr_arg` for an example
#[cfg_attr(feature = "strace-parser-regex", allow(dead_code))]
DestinationAddress(String),
}

Expand Down
Loading

0 comments on commit 3a3ab1c

Please sign in to comment.