diff --git a/Grammar b/Grammar index f5d7237..869ae42 100644 --- a/Grammar +++ b/Grammar @@ -11,6 +11,7 @@ := if then end | if then else end | while SEP end + | ( ) | := diff --git a/src/parser.rs b/src/parser.rs index 71e62a0..8b99f2d 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -130,6 +130,12 @@ fn expression(tokens: &mut Tokens) -> ParseResult { Some(&Keyword(Kw::While)) => { while_expression(tokens) }, + Some(&LParen) => { + tokens.next(); + let expr = expression(tokens); + expect!(RParen, tokens); + expr + }, _ => simple_expression(tokens) } }