diff --git a/irp/src/build_dfa.rs b/irp/src/build_dfa.rs index f31dea0..0fdc48b 100644 --- a/irp/src/build_dfa.rs +++ b/irp/src/build_dfa.rs @@ -194,12 +194,12 @@ impl<'a> Builder<'a> { if flash { Action::Flash { length: length.clone(), - complete: true, + partial_consume: true, } } else { Action::Gap { length: length.clone(), - complete: true, + partial_consume: true, } }, ); diff --git a/irp/src/build_nfa.rs b/irp/src/build_nfa.rs index 7ad0740..4c78fb3 100644 --- a/irp/src/build_nfa.rs +++ b/irp/src/build_nfa.rs @@ -29,11 +29,11 @@ pub(crate) enum Length { pub(crate) enum Action { Flash { length: Length, - complete: bool, + partial_consume: bool, }, Gap { length: Length, - complete: bool, + partial_consume: bool, }, Set { var: String, @@ -109,12 +109,12 @@ impl NFA { let actions = vec![if flash { Action::Flash { length: Length::Expression(length), - complete: true, + partial_consume: true, } } else { Action::Gap { length: Length::Expression(length), - complete: true, + partial_consume: true, } }]; @@ -1153,7 +1153,7 @@ impl<'a> Builder<'a> { dest: node, actions: vec![Action::Flash { length: Length::Expression(Rc::new(Expression::Number(len))), - complete: last, + partial_consume: last, }], }); @@ -1172,7 +1172,7 @@ impl<'a> Builder<'a> { dest: node, actions: vec![Action::Gap { length: Length::Expression(Rc::new(Expression::Number(len))), - complete: last, + partial_consume: last, }], }); @@ -1202,7 +1202,7 @@ impl<'a> Builder<'a> { dest: node, actions: vec![Action::Flash { length: Length::Expression(expr), - complete: last, + partial_consume: last, }], }); @@ -1241,7 +1241,7 @@ impl<'a> Builder<'a> { dest: node, actions: vec![Action::Gap { length: Length::Expression(expr), - complete: last, + partial_consume: last, }], }); @@ -1274,7 +1274,7 @@ impl<'a> Builder<'a> { length: Length::Expression(Rc::new(Expression::Identifier( "$extent".into(), ))), - complete: last, + partial_consume: last, }], }); diff --git a/irp/src/decoder.rs b/irp/src/decoder.rs index 4aebd50..44f3661 100644 --- a/irp/src/decoder.rs +++ b/irp/src/decoder.rs @@ -358,7 +358,7 @@ impl<'a> Decoder<'a> { match a { Action::Flash { length: Length::Expression(expected), - complete, + partial_consume: complete, } => { let expected = expected.eval(vartab).unwrap(); @@ -372,7 +372,7 @@ impl<'a> Decoder<'a> { } Action::Flash { length: Length::Range(min, max), - complete, + partial_consume: complete, } => { if ir.is_none() { return ActionResult::Retry(vartable); @@ -389,7 +389,7 @@ impl<'a> Decoder<'a> { } Action::Gap { length: Length::Expression(expected), - complete, + partial_consume: complete, } => { let expected = expected.eval(vartab).unwrap(); @@ -403,7 +403,7 @@ impl<'a> Decoder<'a> { } Action::Gap { length: Length::Range(min, max), - complete, + partial_consume: complete, } => { if ir.is_none() { return ActionResult::Retry(vartable); diff --git a/irp/src/graphviz.rs b/irp/src/graphviz.rs index d9c0eca..9aff676 100644 --- a/irp/src/graphviz.rs +++ b/irp/src/graphviz.rs @@ -115,11 +115,31 @@ fn actions(actions: &[Action]) -> Vec { actions .iter() .map(|a| match a { - Action::Flash { length, complete } => { - format!("flash {length} {}", if *complete { "complete" } else { "" }) + Action::Flash { + length, + partial_consume, + } => { + format!( + "flash {length} {}", + if *partial_consume { + "partial_consume" + } else { + "" + } + ) } - Action::Gap { length, complete } => { - format!("gap {length} {}", if *complete { "complete" } else { "" }) + Action::Gap { + length, + partial_consume, + } => { + format!( + "gap {length} {}", + if *partial_consume { + "partial_consume" + } else { + "" + } + ) } Action::Set { var, expr } => format!("{var} = {expr}"), Action::AssertEq { left, right } => format!("assert {left} = {right}",),