mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-30 11:27:19 +02:00
Parser
- Modified to obey rc.debug.parser.
This commit is contained in:
parent
fa011c5bfb
commit
f0e4f3f4dc
2 changed files with 10 additions and 3 deletions
|
@ -48,6 +48,7 @@ static int safetyValveDefault = 10;
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Parser::Parser ()
|
||||
: _debug (0)
|
||||
{
|
||||
_tree = new Tree ("root");
|
||||
}
|
||||
|
@ -177,6 +178,8 @@ Tree* Parser::tree ()
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
Tree* Parser::parse ()
|
||||
{
|
||||
_debug = context.config.getInteger ("debug.parser");
|
||||
|
||||
findBinary ();
|
||||
findTerminator ();
|
||||
resolveAliases ();
|
||||
|
@ -581,7 +584,8 @@ void Parser::injectDefaults ()
|
|||
std::string defaultCommand = context.config.get ("default.command");
|
||||
if (defaultCommand != "")
|
||||
{
|
||||
context.debug ("No command or sequence found - assuming default.command.");
|
||||
if (_debug >= 1)
|
||||
context.debug ("No command or sequence found - assuming default.command.");
|
||||
|
||||
// Split the defaultCommand into args, and add them in reverse order,
|
||||
// because captureFirst inserts args immediately after the command, and
|
||||
|
@ -619,7 +623,8 @@ void Parser::injectDefaults ()
|
|||
}
|
||||
else
|
||||
{
|
||||
context.debug ("Sequence but no command found - assuming 'information' command.");
|
||||
if (_debug >= 1)
|
||||
context.debug ("Sequence but no command found - assuming 'information' command.");
|
||||
context.header (STRING_ASSUME_INFO);
|
||||
Tree* t = captureFirst ("information");
|
||||
t->tag ("ASSUMED");
|
||||
|
@ -1776,7 +1781,8 @@ void Parser::validate ()
|
|||
std::vector <Tree*>::iterator i;
|
||||
for (i = nodes.begin (); i != nodes.end (); ++i)
|
||||
if ((*i)->hasTag ("?"))
|
||||
context.debug ("Unrecognized argument '" + (*i)->attribute ("raw") + "'");
|
||||
if (_debug >= 1)
|
||||
context.debug ("Unrecognized argument '" + (*i)->attribute ("raw") + "'");
|
||||
|
||||
// TODO Any RC node must have a root/+RC @file that exists.
|
||||
// TODO There must be a root/+CMD.
|
||||
|
|
|
@ -90,6 +90,7 @@ private:
|
|||
void validate ();
|
||||
|
||||
private:
|
||||
int _debug;
|
||||
Tree* _tree;
|
||||
std::multimap <std::string, std::string> _entities;
|
||||
std::map <std::string, std::string> _aliases;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue