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, .{
.{ "property", .Keyword_property },
.{ "define", .Keyword_define },
.{ "require", .Keyword_require },
.{ "false", .Keyword_false },
.{ "null", .Keyword_null },
@ -100,6 +101,7 @@ pub const Token = struct {
ShebangLine,
Keyword_property,
Keyword_define,
Keyword_require,
Keyword_false,
Keyword_null,
@ -184,6 +186,7 @@ pub const Token = struct {
.Tilde => "~",
.Keyword_property => "property",
.Keyword_define => "define",
.Keyword_require => "require",
.Keyword_false => "false",
.Keyword_null => "null",
@ -565,7 +568,9 @@ pub const Tokenizer = struct {
},
.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 => {
if (Token.getKeyword(self.buffer[result.loc.start..self.index])) |id| {
result.id = id;