angle brackets

This commit is contained in:
2024-05-12 16:18:45 +02:00
parent ff84b62d3b
commit 9d7e560feb
2 changed files with 35 additions and 3 deletions
+7
View File
@@ -92,6 +92,13 @@ impl Parser {
ast_res.tokens.push(self.tokens[index+1].clone());
ast_res.ast_type = AstType::VariableDeceleration;
self.index += 1;
} else if self.tokens[index+2].token_type==TokenType::Identifier && self.tokens[index+1].token_type==TokenType::Angle {
ast_res.tokens.push(self.tokens[index+2].clone());
ast_res.tokens[0].value += "<";
ast_res.tokens[0].value += self.tokens[index+1].value.as_str();
ast_res.tokens[0].value += ">";
ast_res.ast_type = AstType::VariableDeceleration;
self.index += 2;
} else if self.tokens[index+1].value=="mut" && self.tokens[index+2].token_type==TokenType::Identifier {
ast_res.tokens.push(self.tokens[index+2].clone());
ast_res.ast_type = AstType::MutVariableDeceleration;