fix dbg!s and bash head on lexer
This commit is contained in:
parent
53eaf000a0
commit
82e43a271e
|
@ -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)
|
||||||
|
|
|
@ -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(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue