From d8df98ba01e7bfe3b724c0b928407db12775e888 Mon Sep 17 00:00:00 2001 From: greg Date: Fri, 17 Feb 2017 21:36:39 -0800 Subject: [PATCH] Beginnings of list literals --- src/schala_lang/parser.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/schala_lang/parser.rs b/src/schala_lang/parser.rs index 446137c..7b58799 100644 --- a/src/schala_lang/parser.rs +++ b/src/schala_lang/parser.rs @@ -17,9 +17,10 @@ use std::convert::From; // // expression := postop_expression (op postop_expression)* // postop_expression := primary_expression postop -// primary_expression := number_expr | String | identifier_expr | paren_expr | conditional_expr | while_expr | lambda_expr +// primary_expression := number_expr | String | identifier_expr | paren_expr | conditional_expr | while_expr | lambda_expr | list_expr // number_expr := (PLUS | MINUS ) number_expr | Number // identifier_expr := call_expression | Variable +// list_expr := LSquareBracket exprlist RSquareBracket // call_expression := Identifier LParen exprlist RParen // while_expr := WHILE primary_expression LCurlyBrace (expression delimiter)* RCurlyBrace // paren_expr := LParen expression RParen @@ -432,6 +433,7 @@ impl Parser { Some(Identifier(_)) => try!(self.identifier_expr()), Some(Token::LParen) => try!(self.paren_expr()), Some(Keyword(Kw::Fn)) => try!(self.lambda_expr()), + Some(Token::LSquareBracket) => try!(self.list_expr()), Some(e) => { return ParseError::result_from_str(&format!("Expected primary expression, got \ {:?}", @@ -441,6 +443,10 @@ impl Parser { }) } + fn list_expr(&mut self) -> ParseResult { + unimplemented!() + } + fn number_expression(&mut self) -> ParseResult { let mut multiplier = 1; loop {