[fine] Use keyword
This commit is contained in:
parent
d73f77cf00
commit
93cc30ba9b
1 changed files with 10 additions and 3 deletions
|
|
@ -44,6 +44,7 @@ pub enum TokenKind {
|
|||
Select,
|
||||
This,
|
||||
True,
|
||||
Use,
|
||||
While,
|
||||
Yield,
|
||||
|
||||
|
|
@ -326,6 +327,11 @@ impl<'a> Tokens<'a> {
|
|||
return TokenKind::True;
|
||||
}
|
||||
}
|
||||
'u' => {
|
||||
if ident == "use" {
|
||||
return TokenKind::Use;
|
||||
}
|
||||
}
|
||||
'w' => {
|
||||
if ident == "while" {
|
||||
return TokenKind::While;
|
||||
|
|
@ -535,7 +541,7 @@ mod tests {
|
|||
|
||||
test_tokens!(
|
||||
more_keywords,
|
||||
"fun if let print return select this true while truewhile",
|
||||
"fun if let print return select this true use while truewhile",
|
||||
(0, Fun, "fun"),
|
||||
(4, If, "if"),
|
||||
(7, Let, "let"),
|
||||
|
|
@ -544,8 +550,9 @@ mod tests {
|
|||
(24, Select, "select"),
|
||||
(31, This, "this"),
|
||||
(36, True, "true"),
|
||||
(41, While, "while"),
|
||||
(47, Identifier, "truewhile")
|
||||
(41, Use, "use"),
|
||||
(45, While, "while"),
|
||||
(51, Identifier, "truewhile")
|
||||
);
|
||||
|
||||
test_tokens!(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue