Skip to content

Commit

Permalink
Whoops, I don't think a test feature flag exists (#895)
Browse files Browse the repository at this point in the history
* Whoops, I don't think a test feature flag exists

* Remove having a special test path for the lrgrammar
  • Loading branch information
Pat-Lafon committed May 17, 2024
1 parent ffd1b4e commit 5e35a80
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 89 deletions.
22 changes: 4 additions & 18 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

Before doing anything else, run `cargo build -p lalrpop`!

From now on use `cargo compile/test -p lalrpop --features=test` instead of
`cargo build -p lalrpop`.

Just before your final commit, run `sh update_lrgrammar.sh`
When making changes the alter the generated code, use `sh update_lrgrammar.sh`
to pass the `verify_lalrpop_generates_itself` test.


### Contributor's "How to"
Expand Down Expand Up @@ -37,20 +35,8 @@ generate your own `lrgrammar.rs` parser. That's how you do it:
$ cargo build -p lalrpop # --release
```

Now you need to tell cargo that you're using `lalrpop/src/parser/lrgrammar.lalrpop` to generate
a new `lrgrammar.rs` inside `{CARGO_OUT_DIR}` and use it for the compilation:

```sh
$ cargo build/test -p lalrpop --features=test
# or
$ cargo build/test -p lalrpop --all-features
```

When this flag is passed, cargo uses not `lalrpop/src/parser/lrgrammar.rs` but the newly generated
`lrgrammar.rs` instead (generating it if needed). From now on you use this command.

Once you're done with your work, all the tests are passed, and you are ready to finally commit
you changes run
Once you're done with your work, make sure that you are running against an
updated version of the grammar.

```sh
$ sh update_lrgrammar.sh
Expand Down
62 changes: 0 additions & 62 deletions lalrpop/build.rs

This file was deleted.

9 changes: 0 additions & 9 deletions lalrpop/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,11 @@ use crate::grammar::parse_tree::*;
use crate::grammar::pattern::*;
use crate::tok;

#[cfg(not(feature = "test"))]
#[rustfmt::skip]
#[allow(dead_code)]
#[allow(clippy::all)]
mod lrgrammar;

#[cfg(feature = "test")]
lalrpop_mod!(
#[rustfmt::skip]
#[allow(dead_code)]
#[allow(clippy::all)]
lrgrammar,
"/src/parser/lrgrammar.rs"
);

#[cfg(test)]
mod test;
Expand Down

0 comments on commit 5e35a80

Please sign in to comment.