diff options
Diffstat (limited to 'src/parser.zig')
| -rw-r--r-- | src/parser.zig | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/parser.zig b/src/parser.zig index 7e1b695..ce1e4cb 100644 --- a/src/parser.zig +++ b/src/parser.zig @@ -61,6 +61,7 @@ pub const Node = union(enum) { BOOLEAN: struct { value: bool, }, + NULL: void, CHAR: struct { value: u8, }, @@ -525,7 +526,7 @@ pub const Parser = struct { } }); } - // PrimaryExpression ::= NUMBER | BOOLEAN | CHAR | STRING | IDENTIFIER | FunctionCallStatement | FunctionDefinition | LPAREN Expression RPAREN + // PrimaryExpression ::= NULL | NUMBER | BOOLEAN | CHAR | STRING | IDENTIFIER | FunctionCallStatement | FunctionDefinition | LPAREN Expression RPAREN fn parse_primary_expression(self: *Parser) ParserError!*Node { errdefer if (!self.try_context) std.debug.print("Error parsing primary expression {any}\n", .{self.peek_token()}); @@ -542,6 +543,9 @@ pub const Parser = struct { const token = self.consume_token() orelse return ParserError.ParsingError; return switch (token.type) { + .NULL => try self.create_node(.{ + .PRIMARY_EXPRESSION = .{ .NULL = void{} }, + }), .NUMBER => |number_token| try self.create_node(.{ .PRIMARY_EXPRESSION = .{ .NUMBER = .{ |