Grooming, reading source info, parsing Class WIP.

mess
Karchnu 2020-12-16 18:38:11 +01:00
parent a93c718e1f
commit 0d9130ec89
2 changed files with 109 additions and 3064 deletions

File diff suppressed because it is too large Load Diff

View File

@ -12,6 +12,7 @@ pub const Token = struct {
pub const keywords = std.ComptimeStringMap(Id, .{ pub const keywords = std.ComptimeStringMap(Id, .{
.{ "property", .Keyword_property }, .{ "property", .Keyword_property },
.{ "define", .Keyword_define },
.{ "require", .Keyword_require }, .{ "require", .Keyword_require },
.{ "false", .Keyword_false }, .{ "false", .Keyword_false },
.{ "null", .Keyword_null }, .{ "null", .Keyword_null },
@ -100,6 +101,7 @@ pub const Token = struct {
ShebangLine, ShebangLine,
Keyword_property, Keyword_property,
Keyword_define,
Keyword_require, Keyword_require,
Keyword_false, Keyword_false,
Keyword_null, Keyword_null,
@ -184,6 +186,7 @@ pub const Token = struct {
.Tilde => "~", .Tilde => "~",
.Keyword_property => "property", .Keyword_property => "property",
.Keyword_define => "define",
.Keyword_require => "require", .Keyword_require => "require",
.Keyword_false => "false", .Keyword_false => "false",
.Keyword_null => "null", .Keyword_null => "null",
@ -565,7 +568,9 @@ pub const Tokenizer = struct {
}, },
.identifier => switch (c) { .identifier => switch (c) {
'a'...'z', 'A'...'Z', '_', '0'...'9' => {}, // Include "-" as an identifer token, this is the only difference
// with the Zig tokenizer.
'a'...'z', 'A'...'Z', '_', '-', '0'...'9' => {},
else => { else => {
if (Token.getKeyword(self.buffer[result.loc.start..self.index])) |id| { if (Token.getKeyword(self.buffer[result.loc.start..self.index])) |id| {
result.id = id; result.id = id;