Finish keyword tokenization

This commit is contained in:
greg 2016-01-09 02:19:05 -08:00
parent 49be163181
commit 570650cbfa

View File

@ -24,7 +24,6 @@ pub enum Kw {
Let, Let,
Fn, Fn,
Null, Null,
Assign
} }
fn is_digit(c: &char) -> bool { fn is_digit(c: &char) -> bool {
@ -110,6 +109,12 @@ pub fn tokenize(input: &str) -> Option<Vec<Token>> {
match &buffer[..] { match &buffer[..] {
"if" => Keyword(Kw::If), "if" => Keyword(Kw::If),
"then" => Keyword(Kw::Then), "then" => Keyword(Kw::Then),
"else" => Keyword(Kw::Else),
"while" => Keyword(Kw::While),
"end" => Keyword(Kw::End),
"let" => Keyword(Kw::Let),
"fn" => Keyword(Kw::Fn),
"null" => Keyword(Kw::Null),
b => Identifier(b.to_string()) b => Identifier(b.to_string())
} }
}; };