remove java implementation, was merely a book copy
This commit is contained in:
parent
175f672dd6
commit
c869360aaa
63 changed files with 4 additions and 2501 deletions
26
src/keywords.rs
Normal file
26
src/keywords.rs
Normal file
|
@ -0,0 +1,26 @@
|
|||
use crate::token::TokenType::{self, *};
|
||||
use lazy_static::lazy_static;
|
||||
use std::collections::HashMap;
|
||||
|
||||
lazy_static! {
|
||||
/// Mapping of reserved keywords to their respective TokenType.
|
||||
pub static ref KEYWORDS: HashMap<std::string::String, TokenType> = {
|
||||
let mut m = HashMap::new();
|
||||
m.insert("and".into(), And);
|
||||
m.insert("class".into(), Class);
|
||||
m.insert("else".into(), Else);
|
||||
m.insert("false".into(), False);
|
||||
m.insert("for".into(), For);
|
||||
m.insert("fun".into(), Fun);
|
||||
m.insert("if".into(), If);
|
||||
m.insert("nil".into(), Nil);
|
||||
m.insert("or".into(), Or);
|
||||
m.insert("print".into(), Print);
|
||||
m.insert("return".into(), Return);
|
||||
m.insert("super".into(), Super);
|
||||
m.insert("true".into(), True);
|
||||
m.insert("var".into(), Var);
|
||||
m.insert("while".into(), While);
|
||||
m
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue