Minor improvement to debug prints.
This commit is contained in:
parent
23f3a512f0
commit
795193483e
3 changed files with 16 additions and 3 deletions
|
@ -16,7 +16,7 @@ struct EventSink {
|
||||||
|
|
||||||
impl MarkedEventReceiver for EventSink {
|
impl MarkedEventReceiver for EventSink {
|
||||||
fn on_event(&mut self, ev: Event, mark: Marker) {
|
fn on_event(&mut self, ev: Event, mark: Marker) {
|
||||||
eprintln!(" \x1B[;34m\u{21B3} {:?}\x1B[;m", &ev);
|
eprintln!(" \x1B[;34m\u{21B3} {:?}\x1B[;m", &ev);
|
||||||
self.events.push((ev, mark));
|
self.events.push((ev, mark));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -411,6 +411,9 @@ impl<T: Iterator<Item = char>> Parser<T> {
|
||||||
fn state_machine(&mut self) -> ParseResult {
|
fn state_machine(&mut self) -> ParseResult {
|
||||||
// let next_tok = self.peek_token().cloned()?;
|
// let next_tok = self.peek_token().cloned()?;
|
||||||
// println!("cur_state {:?}, next tok: {:?}", self.state, next_tok);
|
// println!("cur_state {:?}, next tok: {:?}", self.state, next_tok);
|
||||||
|
if std::env::var("YAMLRUST_DEBUG").is_ok() {
|
||||||
|
eprintln!("\n\x1B[;33mParser state: {:?} \x1B[;0m", self.state);
|
||||||
|
}
|
||||||
match self.state {
|
match self.state {
|
||||||
State::StreamStart => self.stream_start(),
|
State::StreamStart => self.stream_start(),
|
||||||
|
|
||||||
|
|
|
@ -271,7 +271,10 @@ impl<T: Iterator<Item = char>> Iterator for Scanner<T> {
|
||||||
match self.next_token() {
|
match self.next_token() {
|
||||||
Ok(Some(tok)) => {
|
Ok(Some(tok)) => {
|
||||||
if std::env::var("YAMLRUST_DEBUG").is_ok() {
|
if std::env::var("YAMLRUST_DEBUG").is_ok() {
|
||||||
eprintln!("\x1B[;32m{:?} \x1B[;36m{:?}\x1B[;m", tok.1, tok.0);
|
eprintln!(
|
||||||
|
" \x1B[;32m\u{21B3} {:?} \x1B[;36m{:?}\x1B[;m",
|
||||||
|
tok.1, tok.0
|
||||||
|
);
|
||||||
}
|
}
|
||||||
Some(tok)
|
Some(tok)
|
||||||
}
|
}
|
||||||
|
@ -551,7 +554,14 @@ impl<T: Iterator<Item = char>> Scanner<T> {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
self.skip_to_next_token()?;
|
self.skip_to_next_token()?;
|
||||||
// eprintln!("--> fetch_next_token wo ws {:?} {:?}", self.mark, self.ch());
|
|
||||||
|
if std::env::var("YAMLRUST_DEBUG").is_ok() {
|
||||||
|
eprintln!(
|
||||||
|
" \x1B[38;5;244m\u{2192} fetch_next_token after whitespace {:?} {:?}\x1B[m",
|
||||||
|
self.mark,
|
||||||
|
self.ch()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
self.stale_simple_keys()?;
|
self.stale_simple_keys()?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue