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