From 8324d20970d0f38d1add50da51daa7011c5d1920 Mon Sep 17 00:00:00 2001 From: Baitinq Date: Sat, 18 Jan 2025 23:34:35 +0100 Subject: Feature: Add support for substraction --- src/tokenizer.zig | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/tokenizer.zig') diff --git a/src/tokenizer.zig b/src/tokenizer.zig index f5908b2..e395835 100644 --- a/src/tokenizer.zig +++ b/src/tokenizer.zig @@ -20,6 +20,7 @@ pub const TokenType = enum { // Operators EQUALS, PLUS, + MINUS, // Punctuation SEMICOLON, @@ -39,6 +40,7 @@ pub const Token = union(TokenType) { NUMBER: i64, EQUALS: void, PLUS: void, + MINUS: void, SEMICOLON: void, COMMA: void, LPAREN: void, @@ -74,6 +76,7 @@ pub const Tokenizer = struct { if (c == '}') return Token{ .RBRACE = void{} }; if (c == '=') return Token{ .EQUALS = void{} }; if (c == '+') return Token{ .PLUS = void{} }; + if (c == '-') return Token{ .MINUS = void{} }; const string = self.consume_string(); if (string.len == 0) return TokenizerError.TokenizingError; -- cgit 1.4.1