added float and as

This commit is contained in:
2024-05-18 17:43:39 +02:00
parent a5e23db625
commit ae281d70d1
3 changed files with 35 additions and 25 deletions
+9 -1
View File
@@ -72,7 +72,7 @@ const SYNTAX: [Node; 14] = [
},
Node {
token_type: TokenType::Keyword,
token_regex: Lazy::new(|| Regex::new(r"^(mut|try|catch|return|fn|let|use|cb|struct|impl|for|in)\b").unwrap())
token_regex: Lazy::new(|| Regex::new(r"^(mut|try|catch|return|fn|let|use|cb|struct|impl|for|in|as)\b").unwrap())
},
Node {
token_type: TokenType::Identifier,
@@ -386,6 +386,14 @@ pub fn lex(mut code: &str, use_whitespace: bool, state: LexerState) -> Result<Ve
column: state.column
});
}
"float" => {
tokens.push(Token {
token_type: s.token_type,
value: "f32".to_string(),
line: state.line,
column: state.column
});
}
_ => {
tokens.push(Token {
token_type: s.token_type,