summaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/main.zig b/src/main.zig
index 4a0bbca..2ca0b68 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -45,21 +45,15 @@ pub fn main() !void {
switch (t) {
.ret => {
const num = tokIter.next();
- switch (num.?) {
- .intLit => {},
- else => break,
- }
- switch (tokIter.next().?) {
- .semiCol => {},
- else => break,
- }
+ if (!tok.checkType(num.?, tok.TokenType.intLit)) return error.SyntaxError;
+
+ if (!tok.checkType(tokIter.next().?, tok.TokenType.semiCol)) return error.SyntaxError;
try outWriter.print(
\\ mov rax, 60
\\ mov rdi, {}
\\ syscall
\\
, .{num.?.intLit});
- gpa.allocator().free(t.ret);
},
// No other commands
else => {},