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 <alekratz@gmail.com>
This commit is contained in:
2020-09-17 13:26:38 -07:00
parent 1be0fb8a04
commit 38b7124fe2
3 changed files with 11 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ edition = "2018"
cfgrammar = "0.9" cfgrammar = "0.9"
lrpar = "0.9" lrpar = "0.9"
lrlex = "0.9" lrlex = "0.9"
rerun_except = "0.1.2"
[dependencies] [dependencies]
cfgrammar = "0.9" cfgrammar = "0.9"

View File

@@ -1,8 +1,13 @@
use cfgrammar::yacc::YaccKind; use cfgrammar::yacc::YaccKind;
use lrlex::LexerBuilder; use lrlex::LexerBuilder;
use lrpar::CTParserBuilder; use lrpar::CTParserBuilder;
use rerun_except::rerun_except;
fn main() -> Result<(), Box<dyn std::error::Error>> { fn main() -> Result<(), Box<dyn std::error::Error>> {
// Skip rerunning if it's just *.not files that have changed
rerun_except(&["*.not"]).unwrap();
// Build parser + lexer
let mut parser_builder = CTParserBuilder::new() let mut parser_builder = CTParserBuilder::new()
.yacckind(YaccKind::Grmtools) .yacckind(YaccKind::Grmtools)
.error_on_conflicts(false); .error_on_conflicts(false);

5
examples/expr.not Normal file
View File

@@ -0,0 +1,5 @@
kilo = pow(2, 10)
mega = pow(2, 20)
giga = pow(2, 30)
tera = pow(2, 40)
peta = pow(2, 50)