From 479a098e0ff44f214e5ee10238d6d08fb5398043 Mon Sep 17 00:00:00 2001 From: greg Date: Wed, 9 Jan 2019 17:37:51 -0800 Subject: [PATCH] Make note to fix parsing bug --- schala-lang/language/src/parsing.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/schala-lang/language/src/parsing.rs b/schala-lang/language/src/parsing.rs index 87e6347..f9a8c95 100644 --- a/schala-lang/language/src/parsing.rs +++ b/schala-lang/language/src/parsing.rs @@ -213,7 +213,7 @@ expression := precedence_expr type_anno+ precedence_expr := prefix_expr prefix_expr := prefix_op call_expr prefix_op := '+' | '-' | '!' | '~' -call_expr := index_expr ( '(' expr_list ')' )* +call_expr := index_expr '(' ( expr_list )* ')' expr_list := expression (',' expression)* | ε index_expr := primary ( '[' (expression (',' (expression)* | ε) ']' )* primary := literal | paren_expr | if_expr | for_expr | while_expr | identifier_expr | lambda_expr | anonymous_struct | list_expr @@ -276,7 +276,6 @@ enumerator := identifier '<-' expression | identifier '=' expression //TODO add */ impl Parser { - //TODO make this a proper public interface #[recursive_descent_method] fn program(&mut self) -> ParseResult { let mut statements = Vec::new(); @@ -1242,7 +1241,17 @@ mod parse_tests { parse_test!("a + b", AST(vec![exst!(binexp!("+", val!("a"), val!("b")))])); //parse_test!("a[b]", AST(vec![Expression( //parse_test!("a[]", <- TODO THIS NEEDS TO FAIL - //parse_test!(damn()[a] ,<- TODO needs to succeed + //parse_test("a()[b]()[d]") + //TODO fix this parsing stuff + /* + parse_test! { "perspicacity()[a]", AST(vec![ + exst!(Index { + indexee: bx!(ex!(Call { f: bx!(ex!(val!("perspicacity"))), arguments: vec![] })), + indexers: vec![ex!(val!("a"))] + }) + ]) + } + */ parse_test!("a[b,c]", AST(vec![exst!(Index { indexee: bx!(ex!(val!("a"))), indexers: vec![ex!(val!("b")), ex!(val!("c"))]} )])); parse_test!("None", AST(vec![exst!(val!("None"))]));