some changes
This commit is contained in:
@@ -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 {
|
fn get_first_char(value: &str) -> String {
|
||||||
value.chars().next().unwrap().to_string()
|
value.chars().next().unwrap().to_string()
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-2
@@ -10,6 +10,7 @@ pub enum AstType {
|
|||||||
VariableDeceleration,
|
VariableDeceleration,
|
||||||
MutVariableDeceleration,
|
MutVariableDeceleration,
|
||||||
Include,
|
Include,
|
||||||
|
IncludeLocal,
|
||||||
Other
|
Other
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,11 +172,14 @@ impl Parser {
|
|||||||
}
|
}
|
||||||
TokenType::Include => {
|
TokenType::Include => {
|
||||||
if let Some(caps) = self.include_regex.captures(&token.value) {
|
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) {
|
} 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 {
|
} else {
|
||||||
ast_res.tokens.push(token.clone());
|
ast_res.tokens.push(token.clone());
|
||||||
|
ast_res.ast_type = AstType::Include;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
|||||||
Reference in New Issue
Block a user