summary refs log tree commit diff
path: root/src/tokenizer.zig
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2025-01-22 00:25:22 +0100
committerBaitinq <manuelpalenzuelamerino@gmail.com>2025-01-22 00:25:22 +0100
commita04777a20e60857f880775c3c6ed23c6d1e72eca (patch)
treed5302638c8569a4d0905ef1fd4ef1b4e39e6a2de /src/tokenizer.zig
parentFeature: Add support for while statements (diff)
downloadinterpreter-a04777a20e60857f880775c3c6ed23c6d1e72eca.tar.gz
interpreter-a04777a20e60857f880775c3c6ed23c6d1e72eca.tar.bz2
interpreter-a04777a20e60857f880775c3c6ed23c6d1e72eca.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();