about summary refs log tree commit diff
path: root/src/tokenizer.zig
diff options
context:
space:
mode:
authorBaitinq <[email protected]>2025-01-22 00:25:22 +0100
committerBaitinq <[email protected]>2025-01-22 00:25:22 +0100
commit6d1d1355379feb3273c3634adfc50a1876c40314 (patch)
treed5302638c8569a4d0905ef1fd4ef1b4e39e6a2de /src/tokenizer.zig
parentFeature: Add support for while statements (diff)
downloadinterpreter-6d1d1355379feb3273c3634adfc50a1876c40314.tar.gz
interpreter-6d1d1355379feb3273c3634adfc50a1876c40314.tar.bz2
interpreter-6d1d1355379feb3273c3634adfc50a1876c40314.zip
Feature: Add support for division and multiplication
Diffstat (limited to 'src/tokenizer.zig')
-rw-r--r--src/tokenizer.zig6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/tokenizer.zig b/src/tokenizer.zig
index a5c0e9c..e125110 100644
--- a/src/tokenizer.zig
+++ b/src/tokenizer.zig
@@ -23,6 +23,8 @@ pub const TokenType = enum {
     EQUALS,
     PLUS,
     MINUS,
+    MUL,
+    DIV,
     BANG,
 
     // Punctuation
@@ -46,6 +48,8 @@ pub const Token = union(TokenType) {
     EQUALS: void,
     PLUS: void,
     MINUS: void,
+    MUL: void,
+    DIV: void,
     BANG: void,
     SEMICOLON: void,
     COMMA: void,
@@ -90,6 +94,8 @@ 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{ .MUL = void{} };
+        if (c == '/') return Token{ .DIV = void{} };
         if (c == '!') return Token{ .BANG = void{} };
 
         const string = self.consume_string();