Made parse trace output a bit nicer
Used ... instead of whitespace, removed extraneous "Production"
This commit is contained in:
parent
bb87a87848
commit
8656992945
@ -262,12 +262,13 @@ impl Parser {
|
|||||||
|
|
||||||
pub fn format_parse_trace(&self) -> String {
|
pub fn format_parse_trace(&self) -> String {
|
||||||
let mut buf = String::new();
|
let mut buf = String::new();
|
||||||
|
buf.push_str("Parse productions:\n");
|
||||||
for r in self.parse_record.iter() {
|
for r in self.parse_record.iter() {
|
||||||
let mut indent = String::new();
|
let mut indent = String::new();
|
||||||
for _ in 0..r.level {
|
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
|
buf
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user