mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Grammar: MAde ::dump output more compact, because this is going to get large
This commit is contained in:
parent
e3199833f7
commit
0a9e1f7299
1 changed files with 7 additions and 6 deletions
|
@ -189,17 +189,18 @@ std::vector <std::vector <std::string>> Grammar::augmented () const
|
|||
std::string Grammar::dump () const
|
||||
{
|
||||
std::stringstream out;
|
||||
out << "Grammar\n";
|
||||
for (auto& rule : _rules)
|
||||
{
|
||||
// Indicate the start Rule.
|
||||
if (rule.first == _start)
|
||||
out << "▶ ";
|
||||
|
||||
out << rule.first << ":\n";
|
||||
out << " " << (rule.first == _start ? "▶" : " ") << " " << rule.first << ": ";
|
||||
|
||||
int count = 0;
|
||||
for (auto& production : rule.second)
|
||||
{
|
||||
out << " ";
|
||||
if (count)
|
||||
out << "| ";
|
||||
|
||||
for (auto& token : production)
|
||||
{
|
||||
out << token._token;
|
||||
|
@ -208,7 +209,7 @@ std::string Grammar::dump () const
|
|||
out << " ";
|
||||
}
|
||||
|
||||
out << "\n";
|
||||
++count;
|
||||
}
|
||||
|
||||
out << "\n";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue