diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2025-01-21 20:33:08 +0100 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2025-01-21 20:33:08 +0100 |
commit | 2d0110dc36c41cd062603a47d72cdca6698c8201 (patch) | |
tree | 944419b02fa5f2080c9d86e3f17e7264de5a88f1 | |
parent | Misc: Add `zig build example` step (diff) | |
download | interpreter-2d0110dc36c41cd062603a47d72cdca6698c8201.tar.gz interpreter-2d0110dc36c41cd062603a47d72cdca6698c8201.tar.bz2 interpreter-2d0110dc36c41cd062603a47d72cdca6698c8201.zip |
Tokenizer: Rename NOT token to BANG
-rw-r--r-- | src/parser.zig | 2 | ||||
-rw-r--r-- | src/tokenizer.zig | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/parser.zig b/src/parser.zig index 61038d8..8d531c7 100644 --- a/src/parser.zig +++ b/src/parser.zig @@ -267,7 +267,7 @@ pub const Parser = struct { fn parse_unary_expression(self: *Parser) ParserError!*Node { errdefer if (!self.try_context) std.debug.print("Error parsing unary expression\n", .{}); - const negation = self.accept_token(tokenizer.TokenType.NOT) != null; + const negation = self.accept_token(tokenizer.TokenType.BANG) != null; if (!negation) { return try self.parse_primary_expression(); diff --git a/src/tokenizer.zig b/src/tokenizer.zig index d137763..4e9d383 100644 --- a/src/tokenizer.zig +++ b/src/tokenizer.zig @@ -22,7 +22,7 @@ pub const TokenType = enum { EQUALS, PLUS, MINUS, - NOT, + BANG, // Punctuation SEMICOLON, @@ -44,7 +44,7 @@ pub const Token = union(TokenType) { EQUALS: void, PLUS: void, MINUS: void, - NOT: void, + BANG: void, SEMICOLON: void, COMMA: void, LPAREN: void, @@ -81,7 +81,7 @@ pub const Tokenizer = struct { if (c == '=') return Token{ .EQUALS = void{} }; if (c == '+') return Token{ .PLUS = void{} }; if (c == '-') return Token{ .MINUS = void{} }; - if (c == '!') return Token{ .NOT = void{} }; + if (c == '!') return Token{ .BANG = void{} }; const string = self.consume_string(); if (string.len == 0) return TokenizerError.TokenizingError; |