[fine] Implement the wildcard pattern

This commit is contained in:
John Doty 2024-02-04 19:36:47 -08:00
parent e0721d09fc
commit 65ec2d4cca
5 changed files with 104 additions and 25 deletions

View file

@ -57,6 +57,7 @@ pub enum TokenKind {
Select,
Selff,
True,
Underscore,
While,
Yield,
}
@ -351,6 +352,11 @@ impl<'a> Tokens<'a> {
return TokenKind::Yield;
}
}
'_' => {
if ident == "_" {
return TokenKind::Underscore;
}
}
_ => (),
}
@ -605,10 +611,11 @@ mod tests {
test_tokens!(
more_more_keywords,
"in is match",
"in is match _",
(0, In, "in"),
(3, Is, "is"),
(6, Match, "match")
(6, Match, "match"),
(12, Underscore, "_")
);
test_tokens!(