This commit is contained in:
2024-05-15 19:57:55 +02:00
parent e7142f6d80
commit 9dc8712364
4 changed files with 45 additions and 7 deletions
+6
View File
@@ -6,6 +6,7 @@ use once_cell::sync::Lazy;
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum AstType {
FunctionDeceleration,
StructDeceleration,
VoidFunctionDeceleration,
VariableDeceleration,
PointerDeceleration,
@@ -78,6 +79,11 @@ impl Parser {
ast_res.tokens.push(self.tokens[index].clone());
ast_res.tokens.push(self.tokens[index+2].clone());
self.index += 2;
} else if self.tokens.len()-index > 2 && self.tokens[index].value == "struct" && self.tokens[index+1].token_type==TokenType::Identifier && self.tokens[index+2].token_type==TokenType::Curly {
ast_res.tokens.push(self.tokens[index+1].clone());
ast_res.tokens.push(self.tokens[index+2].clone());
ast_res.ast_type = AstType::StructDeceleration;
self.index += 2;
} else {
match token.token_type {
TokenType::Identifier => {