diff options
author | Roland Reichwein <mail@reichwein.it> | 2020-10-31 18:10:58 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2020-10-31 18:10:58 +0100 |
commit | 8256280b348b4b53fff35c9101ced0a8dfb2c58e (patch) | |
tree | e745b79e98c853cf1891372e8b2a926a5d81fff5 /grammer.cpp | |
parent | ce77838c4f32b9dc237f0c4b17d1f1e1741254d4 (diff) |
CPP::translate() (WIP), documentation, bugfixing
Diffstat (limited to 'grammer.cpp')
-rw-r--r-- | grammer.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/grammer.cpp b/grammer.cpp index d7afaef..31a4bbf 100644 --- a/grammer.cpp +++ b/grammer.cpp @@ -74,7 +74,9 @@ void Compiler::DumpTree() std::string line(indent, ' '); if (ChildIdIsToken(current_index)) { index_t token_id {TokenIdFromChildId(current_index)}; - line += "Token("s + std::to_string(token_id) + "): "s + tokens[token_id].type + "("s + tokens[token_id].value + ")"s; + line += "Token("s + std::to_string(token_id) + "): "s + tokens[token_id].type; + if (tokens[token_id].value != tokens[token_id].type) + line += "("s + tokens[token_id].value + ")"s; } else { auto& node {nodes[current_index]}; line += "Node("s + std::to_string(current_index) + "): "s + node.type + "/" + std::to_string(node.variant); |