Added logging, all Token use the same Loc

This commit is contained in:
2024-10-20 01:35:12 +02:00
parent ebb3eec4f4
commit a6a3c092cc
12 changed files with 97 additions and 63 deletions
+1 -5
View File
@@ -1,15 +1,11 @@
// From https://github.com/ziglang/zig/blob/master/lib/std/zig/tokenizer.zig
const std = @import("std");
const Loc = @import("shared/loc.zig").Loc;
pub const Token = struct {
tag: Tag,
loc: Loc,
pub const Loc = struct {
start: usize,
end: usize,
};
pub const keywords = std.StaticStringMap(Tag).initComptime(.{
.{ "run", .keyword_run },
.{ "help", .keyword_help },
+1 -5
View File
@@ -1,14 +1,10 @@
const std = @import("std");
const Loc = @import("shared/loc.zig").Loc;
pub const Token = struct {
tag: Tag,
loc: Loc,
pub const Loc = struct {
start: usize,
end: usize,
};
pub const Tag = enum {
string_literal,
int_literal,
+1 -5
View File
@@ -1,15 +1,11 @@
// From https://github.com/ziglang/zig/blob/master/lib/std/zig/tokenizer.zig
const std = @import("std");
const Loc = @import("shared/loc.zig").Loc;
pub const Token = struct {
tag: Tag,
loc: Loc,
pub const Loc = struct {
start: usize,
end: usize,
};
pub const types = std.StaticStringMap(Tag).initComptime(.{
.{ "int", .type_int },
.{ "float", .type_float },
+4
View File
@@ -0,0 +1,4 @@
pub const Loc = struct {
start: usize,
end: usize,
};
+1 -5
View File
@@ -1,15 +1,11 @@
// From https://github.com/ziglang/zig/blob/master/lib/std/zig/tokenizer.zig
const std = @import("std");
const Loc = @import("shared/loc.zig").Loc;
pub const Token = struct {
tag: Tag,
loc: Loc,
pub const Loc = struct {
start: usize,
end: usize,
};
pub const keywords = std.StaticStringMap(Tag).initComptime(.{
.{ "GRAB", .keyword_grab },
.{ "UPDATE", .keyword_update },