@@ -23,6 +23,8 @@ pub mod statement;
2323pub ( crate ) use statement:: * ;
2424pub mod condition;
2525pub ( crate ) use condition:: * ;
26+ pub mod expression;
27+ pub ( crate ) use expression:: * ;
2628
2729#[ derive( Parser , Debug ) ]
2830#[ grammar = "grammar.pest" ]
@@ -140,22 +142,6 @@ fn parse_return_statement(
140142 Ok ( Line :: FunctionRet { return_data } )
141143}
142144
143- fn parse_expression (
144- pair : Pair < ' _ , Rule > ,
145- constants : & BTreeMap < String , usize > ,
146- ) -> Result < Expression , ParseError > {
147- match pair. as_rule ( ) {
148- Rule :: expression => parse_expression ( pair. into_inner ( ) . next ( ) . unwrap ( ) , constants) ,
149- Rule :: add_expr => parse_binary_expr ( pair, constants, HighLevelOperation :: Add ) ,
150- Rule :: sub_expr => parse_binary_expr ( pair, constants, HighLevelOperation :: Sub ) ,
151- Rule :: mul_expr => parse_binary_expr ( pair, constants, HighLevelOperation :: Mul ) ,
152- Rule :: div_expr => parse_binary_expr ( pair, constants, HighLevelOperation :: Div ) ,
153- Rule :: exp_expr => parse_binary_expr ( pair, constants, HighLevelOperation :: Exp ) ,
154- Rule :: primary => parse_primary ( pair, constants) ,
155- _ => Err ( ParseError :: SemanticError ( "Invalid expression" . to_string ( ) ) ) ,
156- }
157- }
158-
159145fn parse_array_access (
160146 pair : Pair < ' _ , Rule > ,
161147 constants : & BTreeMap < String , usize > ,
0 commit comments