Made parse trace output a bit nicer

Used ... instead of whitespace, removed extraneous "Production"
This commit is contained in:
greg 2019-10-21 19:11:27 -07:00
parent bb87a87848
commit 8656992945
1 changed files with 3 additions and 2 deletions

View File

@ -262,12 +262,13 @@ impl Parser {
pub fn format_parse_trace(&self) -> String {
let mut buf = String::new();
buf.push_str("Parse productions:\n");
for r in self.parse_record.iter() {
let mut indent = String::new();
for _ in 0..r.level {
indent.push(' ');
indent.push('.');
}
buf.push_str(&format!("{}Production `{}`, token: {}\n", indent, r.production_name, r.next_token))
buf.push_str(&format!("{}`{}`, next token: {}\n", indent, r.production_name, r.next_token))
}
buf
}