aboutsummaryrefslogtreecommitdiff
path: root/rprt-engine/src/parser.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rprt-engine/src/parser.rs')
-rw-r--r--rprt-engine/src/parser.rs56
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 {