debug: Display parser trees at level 2, eval output at 3

This commit is contained in:
Tomas Babej 2015-09-07 18:15:39 +02:00 committed by Paul Beckingham
parent 433d3dedca
commit d210c6d07f
3 changed files with 23 additions and 23 deletions

View file

@ -490,7 +490,7 @@ void CLI2::lexArguments ()
} }
} }
if (context.config.getInteger ("debug.parser") >= 3) if (context.config.getInteger ("debug.parser") >= 2)
context.debug (dump ("CLI2::analyze lexArguments")); context.debug (dump ("CLI2::analyze lexArguments"));
} }
@ -519,7 +519,7 @@ void CLI2::demotion ()
} }
if (changes) if (changes)
if (context.config.getInteger ("debug.parser") >= 3) if (context.config.getInteger ("debug.parser") >= 2)
context.debug (dump ("CLI2::analyze demotion")); context.debug (dump ("CLI2::analyze demotion"));
} }
@ -527,7 +527,7 @@ void CLI2::demotion ()
// Intended to be called after ::add() to perform the final analysis. // Intended to be called after ::add() to perform the final analysis.
void CLI2::analyze () void CLI2::analyze ()
{ {
if (context.config.getInteger ("debug.parser") >= 3) if (context.config.getInteger ("debug.parser") >= 2)
context.debug (dump ("CLI2::analyze")); context.debug (dump ("CLI2::analyze"));
// Process _original_args. // Process _original_args.
@ -651,7 +651,7 @@ const std::vector <std::string> CLI2::getWords (bool filtered)
if (a.hasTag ("MISCELLANEOUS")) if (a.hasTag ("MISCELLANEOUS"))
words.push_back (a.attribute ("raw")); words.push_back (a.attribute ("raw"));
if (context.config.getInteger ("debug.parser") >= 3) if (context.config.getInteger ("debug.parser") >= 2)
{ {
Color colorOrigArgs ("gray10 on gray4"); Color colorOrigArgs ("gray10 on gray4");
std::string message = " "; std::string message = " ";
@ -852,7 +852,7 @@ void CLI2::aliasExpansion ()
context.debug (format (STRING_PARSER_ALIAS_NEST, safetyValveDefault)); context.debug (format (STRING_PARSER_ALIAS_NEST, safetyValveDefault));
if (changes && if (changes &&
context.config.getInteger ("debug.parser") >= 3) context.config.getInteger ("debug.parser") >= 2)
context.debug (dump ("CLI2::analyze aliasExpansion")); context.debug (dump ("CLI2::analyze aliasExpansion"));
} }
@ -887,7 +887,7 @@ void CLI2::canonicalizeNames ()
} }
if (changes && if (changes &&
context.config.getInteger ("debug.parser") >= 3) context.config.getInteger ("debug.parser") >= 2)
context.debug (dump ("CLI2::analyze canonicalizeNames")); context.debug (dump ("CLI2::analyze canonicalizeNames"));
} }
@ -1008,7 +1008,7 @@ void CLI2::categorizeArgs ()
} }
if (changes && if (changes &&
context.config.getInteger ("debug.parser") >= 3) context.config.getInteger ("debug.parser") >= 2)
context.debug (dump ("CLI2::analyze categorizeArgs")); context.debug (dump ("CLI2::analyze categorizeArgs"));
} }
@ -1048,7 +1048,7 @@ bool CLI2::findCommand ()
if (command->accepts_modifications ()) a.tag ("ALLOWSMODIFICATIONS"); if (command->accepts_modifications ()) a.tag ("ALLOWSMODIFICATIONS");
if (command->accepts_miscellaneous ()) a.tag ("ALLOWSMISC"); if (command->accepts_miscellaneous ()) a.tag ("ALLOWSMISC");
if (context.config.getInteger ("debug.parser") >= 3) if (context.config.getInteger ("debug.parser") >= 2)
context.debug (dump ("CLI2::analyze findCommand")); context.debug (dump ("CLI2::analyze findCommand"));
// Stop and indicate command found. // Stop and indicate command found.
@ -1110,7 +1110,7 @@ void CLI2::desugarFilterTags ()
{ {
_args = reconstructed; _args = reconstructed;
if (context.config.getInteger ("debug.parser") >= 3) if (context.config.getInteger ("debug.parser") >= 2)
context.debug (dump ("CLI2::prepareFilter desugarFilterTags")); context.debug (dump ("CLI2::prepareFilter desugarFilterTags"));
} }
} }
@ -1136,7 +1136,7 @@ void CLI2::findStrayModifications ()
} }
if (changes) if (changes)
if (context.config.getInteger ("debug.parser") >= 3) if (context.config.getInteger ("debug.parser") >= 2)
context.debug (dump ("CLI2::prepareFilter findStrayModifications")); context.debug (dump ("CLI2::prepareFilter findStrayModifications"));
} }
@ -1174,7 +1174,7 @@ void CLI2::desugarFilterAttributes ()
// ) // )
// Use this sequence in place of a single value. // Use this sequence in place of a single value.
std::vector <A2> values = lexExpression (value); std::vector <A2> values = lexExpression (value);
if (context.config.getInteger ("debug.parser") >= 3) if (context.config.getInteger ("debug.parser") >= 2)
{ {
context.debug ("CLI2::lexExpression " + name + ":" + value); context.debug ("CLI2::lexExpression " + name + ":" + value);
for (auto& v : values) for (auto& v : values)
@ -1343,7 +1343,7 @@ void CLI2::desugarFilterAttributes ()
{ {
_args = reconstructed; _args = reconstructed;
if (context.config.getInteger ("debug.parser") >= 3) if (context.config.getInteger ("debug.parser") >= 2)
context.debug (dump ("CLI2::prepareFilter desugarFilterAttributes")); context.debug (dump ("CLI2::prepareFilter desugarFilterAttributes"));
} }
} }
@ -1382,7 +1382,7 @@ void CLI2::desugarFilterPatterns ()
{ {
_args = reconstructed; _args = reconstructed;
if (context.config.getInteger ("debug.parser") >= 3) if (context.config.getInteger ("debug.parser") >= 2)
context.debug (dump ("CLI2::prepareFilter desugarFilterPatterns")); context.debug (dump ("CLI2::prepareFilter desugarFilterPatterns"));
} }
} }
@ -1530,7 +1530,7 @@ void CLI2::findIDs ()
} }
if (changes) if (changes)
if (context.config.getInteger ("debug.parser") >= 3) if (context.config.getInteger ("debug.parser") >= 2)
context.debug (dump ("CLI2::prepareFilter findIDs")); context.debug (dump ("CLI2::prepareFilter findIDs"));
} }
@ -1591,7 +1591,7 @@ void CLI2::findUUIDs ()
} }
if (changes) if (changes)
if (context.config.getInteger ("debug.parser") >= 3) if (context.config.getInteger ("debug.parser") >= 2)
context.debug (dump ("CLI2::prepareFilter findUUIDs")); context.debug (dump ("CLI2::prepareFilter findUUIDs"));
} }
@ -1738,7 +1738,7 @@ void CLI2::insertIDExpr ()
{ {
_args = reconstructed; _args = reconstructed;
if (context.config.getInteger ("debug.parser") >= 3) if (context.config.getInteger ("debug.parser") >= 2)
context.debug (dump ("CLI2::prepareFilter insertIDExpr")); context.debug (dump ("CLI2::prepareFilter insertIDExpr"));
} }
} }
@ -1775,7 +1775,7 @@ void CLI2::lexFilterArgs ()
{ {
_args = reconstructed; _args = reconstructed;
if (context.config.getInteger ("debug.parser") >= 3) if (context.config.getInteger ("debug.parser") >= 2)
context.debug (dump ("CLI2::prepareFilter lexFilterArgs")); context.debug (dump ("CLI2::prepareFilter lexFilterArgs"));
} }
} }
@ -1885,7 +1885,7 @@ void CLI2::desugarFilterPlainArgs ()
{ {
_args = reconstructed; _args = reconstructed;
if (context.config.getInteger ("debug.parser") >= 3) if (context.config.getInteger ("debug.parser") >= 2)
context.debug (dump ("CLI2::prepareFilter desugarFilterPlainArgs")); context.debug (dump ("CLI2::prepareFilter desugarFilterPlainArgs"));
} }
} }
@ -1939,7 +1939,7 @@ void CLI2::insertJunctions ()
{ {
_args = reconstructed; _args = reconstructed;
if (context.config.getInteger ("debug.parser") >= 3) if (context.config.getInteger ("debug.parser") >= 2)
context.debug (dump ("CLI2::prepareFilter insertJunctions")); context.debug (dump ("CLI2::prepareFilter insertJunctions"));
} }
} }
@ -2023,7 +2023,7 @@ void CLI2::defaultCommand ()
} }
if (changes && if (changes &&
context.config.getInteger ("debug.parser") >= 3) context.config.getInteger ("debug.parser") >= 2)
context.debug (dump ("CLI2::analyze defaultCommand")); context.debug (dump ("CLI2::analyze defaultCommand"));
} }

View file

@ -450,7 +450,7 @@ int Context::dispatch (std::string &out)
cli2.prepareFilter (); cli2.prepareFilter ();
} }
// With rc.debug.parser == 3, there are more tree dumps than you might want, // With rc.debug.parser == 2, there are more tree dumps than you might want,
// but we need the rc.debug.parser == 1 case covered also, with the final // but we need the rc.debug.parser == 1 case covered also, with the final
// tree. // tree.
if (config.getBoolean ("debug") && if (config.getBoolean ("debug") &&

View file

@ -89,7 +89,7 @@ void Filter::subset (const std::vector <Task>& input, std::vector <Task>& output
// Debug output from Eval during compilation is useful. During evaluation // Debug output from Eval during compilation is useful. During evaluation
// it is mostly noise. // it is mostly noise.
eval.debug (context.config.getInteger ("debug.parser") >= 2 ? true : false); eval.debug (context.config.getInteger ("debug.parser") >= 3 ? true : false);
eval.compileExpression (precompiled); eval.compileExpression (precompiled);
for (auto& task : input) for (auto& task : input)
@ -142,7 +142,7 @@ void Filter::subset (std::vector <Task>& output)
// Debug output from Eval during compilation is useful. During evaluation // Debug output from Eval during compilation is useful. During evaluation
// it is mostly noise. // it is mostly noise.
eval.debug (context.config.getInteger ("debug.parser") >= 2 ? true : false); eval.debug (context.config.getInteger ("debug.parser") >= 3 ? true : false);
eval.compileExpression (precompiled); eval.compileExpression (precompiled);
output.clear (); output.clear ();