summaryrefslogtreecommitdiffstats
path: root/crates/rebel-parse
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2024-05-04 12:19:07 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2024-05-04 17:59:32 +0200
commit50443fbd17651861a738d940d8ebd2883f6f2651 (patch)
tree567320dfa86eed029faa1d2d4477b446ee090c9c /crates/rebel-parse
parent5b3d46bfefe9351cb94be1366ad68fd1a1860f5c (diff)
downloadrebel-50443fbd17651861a738d940d8ebd2883f6f2651.tar
rebel-50443fbd17651861a738d940d8ebd2883f6f2651.zip
rebel-parse: token: add for, if and else keywords
Diffstat (limited to 'crates/rebel-parse')
-rw-r--r--crates/rebel-parse/src/grammar/tokenize.rs3
-rw-r--r--crates/rebel-parse/src/token.rs3
2 files changed, 6 insertions, 0 deletions
diff --git a/crates/rebel-parse/src/grammar/tokenize.rs b/crates/rebel-parse/src/grammar/tokenize.rs
index 70df2c3..a4e25b5 100644
--- a/crates/rebel-parse/src/grammar/tokenize.rs
+++ b/crates/rebel-parse/src/grammar/tokenize.rs
@@ -3,8 +3,11 @@ use crate::token::*;
pub use rules::*;
static KEYWORDS: phf::Map<&'static str, Keyword> = phf::phf_map! {
+ "else" => Keyword::Else,
"false" => Keyword::False,
"fetch" => Keyword::Fetch,
+ "for" => Keyword::For,
+ "if" => Keyword::If,
"let" => Keyword::Let,
"map" => Keyword::Map,
"mut" => Keyword::Mut,
diff --git a/crates/rebel-parse/src/token.rs b/crates/rebel-parse/src/token.rs
index 2f86dbd..59582c3 100644
--- a/crates/rebel-parse/src/token.rs
+++ b/crates/rebel-parse/src/token.rs
@@ -9,8 +9,11 @@ pub enum Token<'a> {
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Keyword {
+ Else,
False,
Fetch,
+ For,
+ If,
Let,
Map,
Mut,