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.
|
/// A map of keywords to token types.
|
||||||
static ref KEYWORDS: HashMap<&'static str, TokenType> = {
|
static ref KEYWORDS: HashMap<&'static str, TokenType> = {
|
||||||
let mut keywords = HashMap::new();
|
let mut keywords = HashMap::new();
|
||||||
keywords.insert("and", TokenType::And);
|
keywords.insert("and", TokenType::And);
|
||||||
keywords.insert("class", TokenType::Class);
|
keywords.insert("break", TokenType::Break);
|
||||||
keywords.insert("else", TokenType::Else);
|
keywords.insert("class", TokenType::Class);
|
||||||
keywords.insert("false", TokenType::False);
|
keywords.insert("continue", TokenType::Continue);
|
||||||
keywords.insert("for", TokenType::For);
|
keywords.insert("else", TokenType::Else);
|
||||||
keywords.insert("fun", TokenType::Fun);
|
keywords.insert("false", TokenType::False);
|
||||||
keywords.insert("if", TokenType::If);
|
keywords.insert("for", TokenType::For);
|
||||||
keywords.insert("nil", TokenType::Nil);
|
keywords.insert("fun", TokenType::Fun);
|
||||||
keywords.insert("or", TokenType::Or);
|
keywords.insert("if", TokenType::If);
|
||||||
keywords.insert("print", TokenType::Print);
|
keywords.insert("nil", TokenType::Nil);
|
||||||
keywords.insert("return", TokenType::Return);
|
keywords.insert("or", TokenType::Or);
|
||||||
keywords.insert("super", TokenType::Super);
|
keywords.insert("print", TokenType::Print);
|
||||||
keywords.insert("this", TokenType::This);
|
keywords.insert("return", TokenType::Return);
|
||||||
keywords.insert("true", TokenType::True);
|
keywords.insert("super", TokenType::Super);
|
||||||
keywords.insert("var", TokenType::Var);
|
keywords.insert("this", TokenType::This);
|
||||||
keywords.insert("while", TokenType::While);
|
keywords.insert("true", TokenType::True);
|
||||||
|
keywords.insert("var", TokenType::Var);
|
||||||
|
keywords.insert("while", TokenType::While);
|
||||||
keywords
|
keywords
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue