]> Repositories - zlox.git/blobdiff - src/Token.zig
Implement closures
[zlox.git] / src / Token.zig
index 596b1baefc7d8052d306c75a2dbf7433ca745360..bceba6e565c1e58599a0338bf292631ba82d5ff1 100644 (file)
@@ -1,20 +1,14 @@
 const std = @import("std");
 const TokenType = @import("token_type.zig").TokenType;
+const Object = @import("object.zig").Object;
 const Token = @This();
 
 type: TokenType,
 lexeme: []const u8,
-literal: ?Literal,
+literal: ?Object,
 line: u32,
 
-pub const Literal = union(enum) {
-    string: []const u8,
-    number: f64,
-    boolean: bool,
-    nil: void,
-};
-
-pub fn init(@"type": TokenType, lexeme: []const u8, literal: ?Literal, line: u32) Token {
+pub fn init(@"type": TokenType, lexeme: []const u8, literal: ?Object, line: u32) Token {
     return .{
         .type = @"type",
         .lexeme = lexeme,