Impl's and pointers
This commit is contained in:
@@ -20,6 +20,7 @@ pub enum AstType {
|
||||
IncludeLocal,
|
||||
CodeBlock,
|
||||
Json,
|
||||
Impl,
|
||||
Other,
|
||||
}
|
||||
|
||||
@@ -110,6 +111,15 @@ impl Parser {
|
||||
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].value == "impl"
|
||||
&& 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::Impl;
|
||||
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
|
||||
@@ -175,6 +185,13 @@ impl Parser {
|
||||
ast_res.tokens[0].value += ">";
|
||||
ast_res.ast_type = AstType::VariableDeceleration;
|
||||
self.index += 2;
|
||||
} else if self.tokens.len() - index > 2
|
||||
&& self.tokens[index + 1].value == "*"
|
||||
&& self.tokens[index + 2].token_type == TokenType::Identifier {
|
||||
ast_res.tokens.push(self.tokens[index].clone());
|
||||
ast_res.tokens.push(self.tokens[index + 1].clone());
|
||||
ast_res.ast_type = AstType::PointerDeceleration;
|
||||
self.index += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user