mirror of
https://github.com/yhirose/cpp-peglib.git
synced 2025-01-22 21:35:29 +00:00
Improved AST printer.
This commit is contained in:
parent
561defea8b
commit
19c3644490
4
peglib.h
4
peglib.h
@ -1854,9 +1854,9 @@ struct AstPrint
|
||||
level_ += 1;
|
||||
for (auto i = 0; i < level_; i++) { std::cout << " "; }
|
||||
if (ast.is_token) {
|
||||
std::cout << ast.name << ": '" << ast.token << "'" << std::endl;
|
||||
std::cout << "- " << ast.name << ": '" << ast.token << "'" << std::endl;
|
||||
} else {
|
||||
std::cout << ast.name << std::endl;
|
||||
std::cout << "+ " << ast.name << std::endl;
|
||||
}
|
||||
for (auto node : ast.nodes) { print(*node); }
|
||||
level_ -= 1;
|
||||
|
Loading…
Reference in New Issue
Block a user