From d1c3b4a81bf2cded0e80a467a88a5dc79a058224 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 19 Aug 2018 18:44:54 -0700 Subject: [PATCH] Starting on halfexprs / binops --- schala-lang/src/parsing.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/schala-lang/src/parsing.rs b/schala-lang/src/parsing.rs index c5060fd..9735790 100644 --- a/schala-lang/src/parsing.rs +++ b/schala-lang/src/parsing.rs @@ -244,8 +244,7 @@ expr_or_block := '{' (statement delimiter)* '}' | expr /* Expression - If */ if_expr := 'if' discriminator ('then' condititional | 'is' simple_pattern_match | guard_block) -discriminator := modified_precedence_expression -modified_precedence_expression := precedence_expr (operator)+ //TODO this is currently hard, rearchitect things +discriminator := precedence_expr (operator)+ conditional := expr_or_block else_clause simple_pattern_match := pattern 'then' conditional else_clause := ε | 'else' expr_or_block @@ -660,7 +659,14 @@ impl Parser { }); parse_method!(discriminator(&mut self) -> ParseResult { - Ok(Discriminator::Simple(self.expression()?)) //TODO make proper + let lhs = self.prefix_expr()?; + Ok(match self.peek() { + //TODO make this whole process nicer + Operator(_) | Period | Pipe | Slash => { + unimplemented!() + }, + _ => Discriminator::Simple(lhs) + }) }); parse_method!(conditional(&mut self) -> ParseResult {