Scanner - break + continue keywords
This commit is contained in:
parent
f8f9d376fb
commit
a403799d22
1 changed files with 18 additions and 16 deletions
|
@ -12,22 +12,24 @@ lazy_static! {
|
|||
/// A map of keywords to token types.
|
||||
static ref KEYWORDS: HashMap<&'static str, TokenType> = {
|
||||
let mut keywords = HashMap::new();
|
||||
keywords.insert("and", TokenType::And);
|
||||
keywords.insert("class", TokenType::Class);
|
||||
keywords.insert("else", TokenType::Else);
|
||||
keywords.insert("false", TokenType::False);
|
||||
keywords.insert("for", TokenType::For);
|
||||
keywords.insert("fun", TokenType::Fun);
|
||||
keywords.insert("if", TokenType::If);
|
||||
keywords.insert("nil", TokenType::Nil);
|
||||
keywords.insert("or", TokenType::Or);
|
||||
keywords.insert("print", TokenType::Print);
|
||||
keywords.insert("return", TokenType::Return);
|
||||
keywords.insert("super", TokenType::Super);
|
||||
keywords.insert("this", TokenType::This);
|
||||
keywords.insert("true", TokenType::True);
|
||||
keywords.insert("var", TokenType::Var);
|
||||
keywords.insert("while", TokenType::While);
|
||||
keywords.insert("and", TokenType::And);
|
||||
keywords.insert("break", TokenType::Break);
|
||||
keywords.insert("class", TokenType::Class);
|
||||
keywords.insert("continue", TokenType::Continue);
|
||||
keywords.insert("else", TokenType::Else);
|
||||
keywords.insert("false", TokenType::False);
|
||||
keywords.insert("for", TokenType::For);
|
||||
keywords.insert("fun", TokenType::Fun);
|
||||
keywords.insert("if", TokenType::If);
|
||||
keywords.insert("nil", TokenType::Nil);
|
||||
keywords.insert("or", TokenType::Or);
|
||||
keywords.insert("print", TokenType::Print);
|
||||
keywords.insert("return", TokenType::Return);
|
||||
keywords.insert("super", TokenType::Super);
|
||||
keywords.insert("this", TokenType::This);
|
||||
keywords.insert("true", TokenType::True);
|
||||
keywords.insert("var", TokenType::Var);
|
||||
keywords.insert("while", TokenType::While);
|
||||
keywords
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue