[fine] WIP: Classes

This commit is contained in:
John Doty 2024-01-20 08:56:53 -08:00
parent e6c96fde38
commit 0ee89bf26b
7 changed files with 370 additions and 59 deletions

View file

@ -49,6 +49,7 @@ pub enum TokenKind {
Import,
In,
Let,
New,
Or,
Return,
Select,
@ -302,6 +303,11 @@ impl<'a> Tokens<'a> {
return TokenKind::Let;
}
}
'n' => {
if ident == "new" {
return TokenKind::New;
}
}
'o' => {
if ident == "or" {
return TokenKind::Or;
@ -573,7 +579,7 @@ mod tests {
test_tokens!(
more_keywords,
"fun if import let return select this true while truewhile",
"fun if import let return select this true while truewhile new",
(0, Fun, "fun"),
(4, If, "if"),
(7, Import, "import"),
@ -583,7 +589,8 @@ mod tests {
(32, This, "this"),
(37, True, "true"),
(42, While, "while"),
(48, Identifier, "truewhile")
(48, Identifier, "truewhile"),
(58, New, "new")
);
test_tokens!(