diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2025-01-22 00:25:22 +0100 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2025-01-22 00:25:22 +0100 |
commit | a04777a20e60857f880775c3c6ed23c6d1e72eca (patch) | |
tree | d5302638c8569a4d0905ef1fd4ef1b4e39e6a2de /src/tokenizer.zig | |
parent | Feature: Add support for while statements (diff) | |
download | interpreter-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.zig | 6 |
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(); |