Preliminary support for binops in if-discriminators
The BNF grammar is a bit more liberal than any successfully-compiled schala program should be, in that it allows things like `if x < is pattern`. It's okay if that parses successfully and then is an error at typechecking.
This commit is contained in:
parent
98f597f00a
commit
0d13b5e3bc
@ -653,12 +653,11 @@ impl Parser {
|
|||||||
|
|
||||||
parse_method!(discriminator(&mut self) -> ParseResult<Discriminator> {
|
parse_method!(discriminator(&mut self) -> ParseResult<Discriminator> {
|
||||||
let lhs = self.prefix_expr()?;
|
let lhs = self.prefix_expr()?;
|
||||||
Ok(match self.peek() {
|
let ref next = self.peek();
|
||||||
//TODO make this whole process nicer
|
Ok(if let Some(op) = BinOp::from_sigil_token(next) {
|
||||||
Operator(_) | Period | Pipe | Slash => {
|
Discriminator::BinOp(lhs, op)
|
||||||
unimplemented!()
|
} else {
|
||||||
},
|
Discriminator::Simple(lhs)
|
||||||
_ => Discriminator::Simple(lhs)
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user