rrevenantt / antlr4rust

ANTLR4 parser generator runtime for Rust programming laguage
Other
404 stars 70 forks source link

Build test grammars with feature, use env var for specifying ANTLR4 jar path #14

Closed dfrankland closed 3 years ago

dfrankland commented 3 years ago

This adds a feature flag so that the crate can be built without running the ANTLR4 jar:

# This works even if ANTLR4 isn't anywhere on disk
cargo build;

# Testing works too using the generated grammars already committed
cargo test;

If one wants to build the tests using the ANTLR4 jar, they can do so too using the env var ANTLR_PATH and the feature generate_test_grammars:

# This uses the grammar files in `./grammars` to produce the Rust code in `./tests/gen`
env ANTLR_PATH=../antlr4/tool/target/antlr4-4.8-2-SNAPSHOT-complete.jar cargo build --features generate_test_grammars

Additionally, the missing generated grammar files for perf were added.