From bd2d61d91b91ad7c10f87c9273a09705535e40bc Mon Sep 17 00:00:00 2001 From: Ziyang Hu Date: Thu, 7 Apr 2022 23:15:54 +0800 Subject: [PATCH] rename --- src/ast.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ast.rs b/src/ast.rs index 7d31d286..07f89a0a 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -59,7 +59,7 @@ pub enum Expr<'a> { Const(Value<'a>), } -fn parse_expr_infix<'a>(lhs: Result, CozoError>, op: Pair, rhs: Result, CozoError>) -> Result, CozoError> { +fn build_expr_infix<'a>(lhs: Result, CozoError>, op: Pair, rhs: Result, CozoError>) -> Result, CozoError> { let lhs = lhs?; let rhs = rhs?; if let (Const(a), Const(b)) = (lhs, rhs) { @@ -197,10 +197,10 @@ fn parse_s_quoted_string(pairs: Pairs) -> Result { Ok(ret) } -fn parse_expr_primary(pair: Pair) -> Result { +fn build_expr_primary(pair: Pair) -> Result { match pair.as_rule() { - Rule::expr => parse_expr_primary(pair.into_inner().next().unwrap()), - Rule::term => parse_expr_primary(pair.into_inner().next().unwrap()), + Rule::expr => build_expr_primary(pair.into_inner().next().unwrap()), + Rule::term => build_expr_primary(pair.into_inner().next().unwrap()), Rule::pos_int => Ok(Const(Value::Int(pair.as_str().replace('_', "").parse::()?))), Rule::hex_pos_int => Ok(Const(Value::Int(parse_int(pair.as_str(), 16)))), @@ -218,13 +218,13 @@ fn parse_expr_primary(pair: Pair) -> Result { } } -fn parse_expr(pair: Pair) -> Result { - PREC_CLIMBER.climb(pair.into_inner(), parse_expr_primary, parse_expr_infix) +fn build_expr(pair: Pair) -> Result { + PREC_CLIMBER.climb(pair.into_inner(), build_expr_primary, build_expr_infix) } pub fn parse_expr_from_str(inp: &str) -> Result { let expr_tree = Parser::parse(Rule::expr, inp)?.next().unwrap(); - parse_expr(expr_tree) + build_expr(expr_tree) } #[cfg(test)]