summary refs log tree commit diff
path: root/src/parser.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser.zig')
-rw-r--r--src/parser.zig9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/parser.zig b/src/parser.zig
index f87c406..76f2127 100644
--- a/src/parser.zig
+++ b/src/parser.zig
@@ -217,10 +217,17 @@ pub const Parser = struct {
         } });
     }
 
-    // Expression ::= EqualityExpression | AdditiveExpression | FunctionDefinition
+    // Expression   ::= EqualityExpression | AdditiveExpression | FunctionDefinition | LPAREN Expression RPAREN
     fn parse_expression(self: *Parser) ParserError!*Node {
         errdefer if (!self.try_context) std.debug.print("Error parsing expression\n", .{});
 
+        if (self.accept_token(tokenizer.TokenType.LPAREN)) |_| {
+            const expr = try self.parse_expression();
+            _ = try self.parse_token(tokenizer.TokenType.RPAREN);
+            std.debug.print("HERE!\n", .{});
+            return expr;
+        }
+
         return self.accept_parse(parse_equality_expression) orelse
             self.accept_parse(parse_additive_expression) orelse
             self.accept_parse(parse_function_definition) orelse