about summary refs log tree commit diff
path: root/src/tokenizer.zig
diff options
context:
space:
mode:
authorBaitinq <[email protected]>2025-01-18 23:34:35 +0100
committerBaitinq <[email protected]>2025-01-18 23:34:35 +0100
commit8324d20970d0f38d1add50da51daa7011c5d1920 (patch)
tree8f8995827dce38bb5a9a57b753178f36935e4c85 /src/tokenizer.zig
parentFeature: Add basic support for if statements (diff)
downloadinterpreter-8324d20970d0f38d1add50da51daa7011c5d1920.tar.gz
interpreter-8324d20970d0f38d1add50da51daa7011c5d1920.tar.bz2
interpreter-8324d20970d0f38d1add50da51daa7011c5d1920.zip
Feature: Add support for substraction
Diffstat (limited to 'src/tokenizer.zig')
-rw-r--r--src/tokenizer.zig3
1 files changed, 3 insertions, 0 deletions
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;