struct var defs
This commit is contained in:
@@ -7,6 +7,8 @@ use once_cell::sync::Lazy;
|
||||
pub enum AstType {
|
||||
FunctionDeceleration,
|
||||
StructDeceleration,
|
||||
StructCall,
|
||||
StructVar,
|
||||
VoidFunctionDeceleration,
|
||||
VariableDeceleration,
|
||||
PointerDeceleration,
|
||||
@@ -98,6 +100,15 @@ impl Parser {
|
||||
ast_res.ast_type = AstType::FunctionDeceleration;
|
||||
}
|
||||
self.index += 3;
|
||||
} else if self.tokens.len()-index > 1 && self.tokens[index+1].token_type==TokenType::Curly {
|
||||
ast_res.tokens.push(self.tokens[index+1].clone());
|
||||
ast_res.ast_type = AstType::StructCall;
|
||||
self.index += 1;
|
||||
} else if self.tokens.len()-index > 2 && 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::StructVar;
|
||||
self.index += 2;
|
||||
} else if self.tokens.len()-index > 1 {
|
||||
if self.tokens[index+1].token_type==TokenType::Identifier {
|
||||
ast_res.tokens.push(self.tokens[index+1].clone());
|
||||
|
||||
Reference in New Issue
Block a user