From 38b7124fe2e875d783de09ca795222fe5d713cfc Mon Sep 17 00:00:00 2001 From: Alek Ratzloff Date: Thu, 17 Sep 2020 13:26:38 -0700 Subject: [PATCH] Add rerun_except crate, and small example code * rerun_except will ensure a build doesn't rerun if a *.not file is modified, which it would otherwise do * Add examples/expr.not with some basic assignment statements and function calls Signed-off-by: Alek Ratzloff --- Cargo.toml | 1 + build.rs | 5 +++++ examples/expr.not | 5 +++++ 3 files changed, 11 insertions(+) create mode 100644 examples/expr.not diff --git a/Cargo.toml b/Cargo.toml index c208aaa..c55dcef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ edition = "2018" cfgrammar = "0.9" lrpar = "0.9" lrlex = "0.9" +rerun_except = "0.1.2" [dependencies] cfgrammar = "0.9" diff --git a/build.rs b/build.rs index 102b236..31abb1b 100644 --- a/build.rs +++ b/build.rs @@ -1,8 +1,13 @@ use cfgrammar::yacc::YaccKind; use lrlex::LexerBuilder; use lrpar::CTParserBuilder; +use rerun_except::rerun_except; fn main() -> Result<(), Box> { + // Skip rerunning if it's just *.not files that have changed + rerun_except(&["*.not"]).unwrap(); + + // Build parser + lexer let mut parser_builder = CTParserBuilder::new() .yacckind(YaccKind::Grmtools) .error_on_conflicts(false); diff --git a/examples/expr.not b/examples/expr.not new file mode 100644 index 0000000..b9ad12e --- /dev/null +++ b/examples/expr.not @@ -0,0 +1,5 @@ +kilo = pow(2, 10) +mega = pow(2, 20) +giga = pow(2, 30) +tera = pow(2, 40) +peta = pow(2, 50)