diff options
| author | tslil <tslil@posteo.de> | 2026-03-21 20:21:32 +0000 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2026-03-21 20:37:21 +0000 |
| commit | 139047379b2ff7751c1b5ef8e079ffc29cce752d (patch) | |
| tree | 268f05bb48cc0110a65202740ff763c3c133b9b0 /rprt-engine/src/parser.rs | |
| parent | 89d299376c97a3f866dccc15321713ce955d8125 (diff) | |
implement hooks, fix docs
Diffstat (limited to 'rprt-engine/src/parser.rs')
| -rw-r--r-- | rprt-engine/src/parser.rs | 56 |
1 files changed, 32 insertions, 24 deletions
diff --git a/rprt-engine/src/parser.rs b/rprt-engine/src/parser.rs index 7b68473..e6a9c0b 100644 --- a/rprt-engine/src/parser.rs +++ b/rprt-engine/src/parser.rs @@ -179,8 +179,8 @@ fn parse_function_atom(context: &mut ParseContext) -> Result<Composite, ParseErr let rest = parse_composition(context)?; return Ok(Composite::Hook { kind: HookKind::Before, - left: Box::new(result), - right: Box::new(rest), + f: Box::new(result), + g: Box::new(rest), }); } Ok(Token::After) => { @@ -188,8 +188,8 @@ fn parse_function_atom(context: &mut ParseContext) -> Result<Composite, ParseErr let rest = parse_composition(context)?; return Ok(Composite::Hook { kind: HookKind::After, - left: Box::new(result), - right: Box::new(rest), + f: Box::new(result), + g: Box::new(rest), }); } _ => return Ok(result), @@ -673,7 +673,11 @@ mod tests { let result = parse(tokens).unwrap(); println!("{:?}", result); match result { - Composite::Hook { kind, left, right } => { + Composite::Hook { + kind, + f: left, + g: right, + } => { assert_eq!(kind, HookKind::Before); assert!(matches!( *left, @@ -704,15 +708,15 @@ mod tests { match result { Composite::Hook { kind: outer_kind, - left: outer_left, - right: outer_right, + f: outer_left, + g: outer_right, } => { assert_eq!(outer_kind, HookKind::After); match *outer_left { Composite::Hook { kind: inner_kind, - left: inner_left, - right: inner_right, + f: inner_left, + g: inner_right, } => { assert_eq!(inner_kind, HookKind::After); assert!(matches!( @@ -753,8 +757,8 @@ mod tests { match result { Composite::Hook { kind: outer_kind, - left: outer_left, - right: outer_right, + f: outer_left, + g: outer_right, } => { assert_eq!(outer_kind, HookKind::After); assert!(matches!( @@ -767,8 +771,8 @@ mod tests { match *outer_right { Composite::Hook { kind: inner_kind, - left: inner_left, - right: inner_right, + f: inner_left, + g: inner_right, } => { assert_eq!(inner_kind, HookKind::After); assert!(matches!( @@ -802,8 +806,8 @@ mod tests { match result { Composite::Hook { kind: k1, - left: l1, - right: r1, + f: l1, + g: r1, } => { assert_eq!(k1, HookKind::Before); assert!(matches!( @@ -817,8 +821,8 @@ mod tests { match *r1 { Composite::Hook { kind: k2, - left: l2, - right: r2, + f: l2, + g: r2, } => { assert_eq!(k2, HookKind::After); assert!(matches!( @@ -831,8 +835,8 @@ mod tests { match *r2 { Composite::Hook { kind: k3, - left: l3, - right: r3, + f: l3, + g: r3, } => { assert_eq!(k3, HookKind::Before); assert!(matches!( @@ -867,7 +871,11 @@ mod tests { let result = parse(tokens).unwrap(); println!("{:?}", result); match result { - Composite::Hook { kind, left, right } => { + Composite::Hook { + kind, + f: left, + g: right, + } => { assert_eq!(kind, HookKind::Before); assert!(matches!( *left, @@ -966,8 +974,8 @@ mod tests { match &operations[0] { Composite::Hook { kind: HookKind::After, - left, - right, + f: left, + g: right, } => { match left.as_ref() { Composite::SelectionFunction { @@ -1014,8 +1022,8 @@ mod tests { match g.as_ref() { Composite::Hook { kind: HookKind::After, - left, - right, + f: left, + g: right, } => { match left.as_ref() { Composite::SelectionFunction { |
