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.zig10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/parser.zig b/src/parser.zig
index 36f7437..ac66e5d 100644
--- a/src/parser.zig
+++ b/src/parser.zig
@@ -56,6 +56,9 @@ pub const Node = union(NodeType) {
         NUMBER: struct {
             value: i64,
         },
+        BOOLEAN: struct {
+            value: bool,
+        },
         IDENTIFIER: struct {
             name: []const u8,
         },
@@ -237,7 +240,7 @@ pub const Parser = struct {
         return lhs;
     }
 
-    // PrimaryExpression ::= NUMBER | IDENTIFIER | FunctionCallStatement
+    // PrimaryExpression ::= NUMBER | BOOLEAN | IDENTIFIER | FunctionCallStatement
     fn parse_primary_expression(self: *Parser) ParserError!*Node {
         errdefer if (!self.try_context) std.debug.print("Error parsing primary expression\n", .{});
 
@@ -253,6 +256,11 @@ pub const Parser = struct {
                     },
                 },
             }),
+            .BOOLEAN => |boolean_token| try self.create_node(.{
+                .PRIMARY_EXPRESSION = .{ .BOOLEAN = .{
+                    .value = boolean_token,
+                } },
+            }),
             .IDENTIFIER => |identifier_token| try self.create_node(.{
                 .PRIMARY_EXPRESSION = .{
                     .IDENTIFIER = .{