fix dbg!s and bash head on lexer

This commit is contained in:
TerraMaster85 2024-01-16 13:03:27 -05:00
parent 53eaf000a0
commit 82e43a271e
2 changed files with 4 additions and 3 deletions

View File

@ -15,7 +15,7 @@ pub fn lexer(text_source: &str) -> Result<Vec<Token>, Box<dyn Error>> {
}; };
for (i, c) in text_source.chars().enumerate() { for (i, c) in text_source.chars().enumerate() {
dbg!("{} into {}", &c, &state); dbg!("Begin", &c, &state);
// Commenting end // Commenting end
if state.commenting && c == '\n' { if state.commenting && c == '\n' {
@ -104,7 +104,7 @@ pub fn lexer(text_source: &str) -> Result<Vec<Token>, Box<dyn Error>> {
state.current_token = String::new(); state.current_token = String::new();
continue; continue;
} }
"(" => { "(" => {t w
state.lexed.push(Token::Bracket(Bracket::Open)); state.lexed.push(Token::Bracket(Bracket::Open));
state.current_token = String::new(); state.current_token = String::new();
continue; continue;
@ -149,6 +149,7 @@ pub fn lexer(text_source: &str) -> Result<Vec<Token>, Box<dyn Error>> {
&_ => {} &_ => {}
} }
state.current_token.push(c); state.current_token.push(c);
dbg!("End", &c, &state);
} }
Ok(state.lexed) Ok(state.lexed)

View File

@ -44,7 +44,7 @@ fn main() -> Result<(), Box<dyn Error>> {
Ok(lexed) => lexed, Ok(lexed) => lexed,
}; };
dbg!("Lexed length {}", lexed.len()); dbg!(lexed.len());
Ok(()) Ok(())
} }