some changes

This commit is contained in:
Leo
2024-04-11 16:32:41 +02:00
parent bae3e38318
commit a70c4a1990
2 changed files with 6 additions and 6 deletions
-4
View File
@@ -115,10 +115,6 @@ const SYNTAX: [Node; 15] = [
}
];
fn remove_first_char(value: &str) -> String {
value.chars().skip(1).collect()
}
fn get_first_char(value: &str) -> String {
value.chars().next().unwrap().to_string()
}
+6 -2
View File
@@ -10,6 +10,7 @@ pub enum AstType {
VariableDeceleration,
MutVariableDeceleration,
Include,
IncludeLocal,
Other
}
@@ -171,11 +172,14 @@ impl Parser {
}
TokenType::Include => {
if let Some(caps) = self.include_regex.captures(&token.value) {
println!("bruh: {}", &caps[1]);
ast_res.tokens.push(Token {token_type: TokenType::String, value: caps[2].to_owned().to_string(), line: 0, column: 0});
ast_res.ast_type = AstType::Include;
} else if let Some(caps) = self.include_regex_local.captures(&token.value) {
// ast_res.tokens.push(Token {token_type: TokenType::, value: &caps[1], line: 0, column: 0});
ast_res.tokens.push(Token {token_type: TokenType::String, value: caps[2].to_owned().to_string(), line: 0, column: 0});
ast_res.ast_type = AstType::IncludeLocal;
} else {
ast_res.tokens.push(token.clone());
ast_res.ast_type = AstType::Include;
}
}
_ => {