From a70c4a1990cfa5d65aa2355a28f1540524c28efd Mon Sep 17 00:00:00 2001 From: Leo Date: Thu, 11 Apr 2024 16:32:41 +0200 Subject: [PATCH] some changes --- src/lexer.rs | 4 ---- src/parser.rs | 8 ++++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lexer.rs b/src/lexer.rs index a170d2d..a78ac6a 100644 --- a/src/lexer.rs +++ b/src/lexer.rs @@ -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() } diff --git a/src/parser.rs b/src/parser.rs index 6dc7359..45660f4 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -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; } } _ => {