summary refs log tree commit diff
path: root/src/tokenizer.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/tokenizer.zig')
-rw-r--r--src/tokenizer.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/tokenizer.zig b/src/tokenizer.zig
index 6513978..4eb807a 100644
--- a/src/tokenizer.zig
+++ b/src/tokenizer.zig
@@ -55,6 +55,7 @@ pub const Tokenizer = struct {
 
     pub fn next(self: *Tokenizer) TokenizerError!?Token {
         defer self.offset += 1;
+        self.skip_comments();
         self.skip_whitespace();
 
         if (self.offset >= self.buf.len) return null;
@@ -82,6 +83,14 @@ pub const Tokenizer = struct {
         return Token{ .IDENTIFIER = string };
     }
 
+    fn skip_comments(self: *Tokenizer) void {
+        if (!self.accept_substr("/*")) return;
+
+        while (!self.accept_substr("*/")) {
+            self.offset += 1;
+        }
+    }
+
     fn skip_whitespace(self: *Tokenizer) void {
         while (true) {
             if (self.offset >= self.buf.len) return;