namespaces

This commit is contained in:
2024-05-24 23:22:27 +02:00
parent 8c32610737
commit 1da6b3db09
3 changed files with 26 additions and 2 deletions
+10
View File
@@ -10,6 +10,7 @@ pub enum AstType {
StructCall,
StructVar,
VoidFunctionDeceleration,
Namespace,
VariableDeceleration,
PointerDeceleration,
MutVariableDeceleration,
@@ -100,6 +101,15 @@ impl Parser {
ast_res.tokens.push(self.tokens[index + 2].clone());
ast_res.ast_type = AstType::StructDeceleration;
self.index += 2;
} else if self.tokens.len() - index > 2
&& self.tokens[index].value == "namespace"
&& 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::Namespace;
self.index += 2;
} else if self.tokens.len() - index > 2
&& self.tokens[index].token_type == TokenType::Keyword1
&& self.tokens[index + 1].token_type == TokenType::Round