Start on expr_or_block
WIP doesn't work yet
This commit is contained in:
parent
a72b387ceb
commit
482674b19a
@ -240,6 +240,10 @@ record_pattern := IDENTIFIER '{' (record_pattern_entry, ',')* '}'
|
|||||||
record_pattern_entry := IDENTIFIER | IDENTIFIER ':' Pattern
|
record_pattern_entry := IDENTIFIER | IDENTIFIER ':' Pattern
|
||||||
tuple_struct_pattern := IDENTIFIER '(' (pattern, ',')* ')'
|
tuple_struct_pattern := IDENTIFIER '(' (pattern, ',')* ')'
|
||||||
|
|
||||||
|
|
||||||
|
//TODO when this works bring it to guard_arm
|
||||||
|
expr_or_block := '{' (statement delimiter)* '}' | expr
|
||||||
|
|
||||||
/* Expression - If */
|
/* Expression - If */
|
||||||
if_expr := 'if' discriminator ('then' condititional | 'is' simple_pattern_match | guard_block)
|
if_expr := 'if' discriminator ('then' condititional | 'is' simple_pattern_match | guard_block)
|
||||||
discriminator := modified_precedence_expression
|
discriminator := modified_precedence_expression
|
||||||
@ -694,6 +698,7 @@ impl Parser {
|
|||||||
parse_method!(guard_arm(&mut self) -> ParseResult<GuardArm> {
|
parse_method!(guard_arm(&mut self) -> ParseResult<GuardArm> {
|
||||||
let guard = self.guard()?;
|
let guard = self.guard()?;
|
||||||
expect!(self, Operator(ref c) if **c == "->");
|
expect!(self, Operator(ref c) if **c == "->");
|
||||||
|
println!("WE HIIII? {:?}", self.peek());
|
||||||
let body = self.block()?;
|
let body = self.block()?;
|
||||||
Ok(GuardArm { guard, body })
|
Ok(GuardArm { guard, body })
|
||||||
});
|
});
|
||||||
|
@ -188,7 +188,12 @@ fn reduce_if_expression(discriminator: &Discriminator, body: &IfExpressionBody,
|
|||||||
alternatives,
|
alternatives,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
IfExpressionBody::GuardList(ref _guard_arms) => panic!(),
|
IfExpressionBody::GuardList(ref guard_arms) => {
|
||||||
|
for arm in guard_arms.iter() {
|
||||||
|
//TODO do stuff here!!
|
||||||
|
}
|
||||||
|
Expr::UnimplementedSigilValue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user