- Removed unnecessary Parser calls, leaving only minimal rc processing.
This commit is contained in:
Paul Beckingham 2014-10-31 23:55:03 -04:00
parent 0b212ad8bc
commit 45bcf113d9

View file

@ -217,25 +217,12 @@ int Context::initialize (int argc, const char** argv)
std::map <std::string, Command*>::iterator cmd; std::map <std::string, Command*>::iterator cmd;
for (cmd = commands.begin (); cmd != commands.end (); ++cmd) for (cmd = commands.begin (); cmd != commands.end (); ++cmd)
{ {
parser.entity ("cmd", cmd->first);
cli.entity ("cmd", cmd->first); cli.entity ("cmd", cmd->first);
if (cmd->first[0] == '_') if (cmd->first[0] == '_')
{
parser.entity ("helper", cmd->first);
cli.entity ("helper", cmd->first); cli.entity ("helper", cmd->first);
}
if (cmd->second->read_only ()) cli.entity ((cmd->second->read_only () ? "readcmd" : "writecmd"), cmd->first);
{
parser.entity ("readcmd", cmd->first);
cli.entity ("readcmd", cmd->first);
}
else
{
parser.entity ("writecmd", cmd->first);
cli.entity ("writecmd", cmd->first);
}
} }
// Instantiate built-in column objects. // Instantiate built-in column objects.
@ -244,21 +231,9 @@ int Context::initialize (int argc, const char** argv)
// Extend the fixed list of attribute names with any dynamic ones. // Extend the fixed list of attribute names with any dynamic ones.
std::map <std::string, Column*>::iterator col; std::map <std::string, Column*>::iterator col;
for (col = columns.begin (); col != columns.end (); ++col) for (col = columns.begin (); col != columns.end (); ++col)
{
parser.entity ("attribute", col->first);
cli.entity ("attribute", col->first); cli.entity ("attribute", col->first);
}
// Now the entities are loaded, parsing may resume.
parser.findBinary (); // <task|tw|t|cal|calendar>
parser.resolveAliases ();
parser.findCommand (); // <cmd>
parser.findUUIDList (); // <uuid> Before findIdSequence
parser.findIdSequence (); // <id>
parser.injectDefaults (); // rc.default.command
staticInitialization (); // Decouple code from Context. staticInitialization (); // Decouple code from Context.
parser.parse (); // Parse all elements.
cli.analyze (); // Parse all elements. cli.analyze (); // Parse all elements.
tdb2.set_location (data_dir); // Prepare the task database. tdb2.set_location (data_dir); // Prepare the task database.
@ -687,32 +662,22 @@ void Context::assumeLocations ()
void Context::setupEntities () void Context::setupEntities ()
{ {
// Entities: Pseudo-attributes. Hard-coded. // Entities: Pseudo-attributes. Hard-coded.
parser.entity ("pseudo", "limit");
cli.entity ("pseudo", "limit"); cli.entity ("pseudo", "limit");
// Entities: Attributes. // Entities: Attributes.
for (unsigned int i = 0; i < NUM_ATTRIBUTE_NAMES; ++i) for (unsigned int i = 0; i < NUM_ATTRIBUTE_NAMES; ++i)
{
parser.entity ("attribute", attributeNames[i]);
cli.entity ("attribute", attributeNames[i]); cli.entity ("attribute", attributeNames[i]);
}
// Entities: Modifiers. // Entities: Modifiers.
for (unsigned int i = 0; i < NUM_MODIFIER_NAMES; ++i) for (unsigned int i = 0; i < NUM_MODIFIER_NAMES; ++i)
{
parser.entity ("modifier", modifierNames[i]);
cli.entity ("modifier", modifierNames[i]); cli.entity ("modifier", modifierNames[i]);
}
// Entities: Operators. // Entities: Operators.
std::vector <std::string> operators; std::vector <std::string> operators;
Eval::getOperators (operators); Eval::getOperators (operators);
std::vector <std::string>::iterator op; std::vector <std::string>::iterator op;
for (op = operators.begin (); op != operators.end (); ++op) for (op = operators.begin (); op != operators.end (); ++op)
{
parser.entity ("operator", *op);
cli.entity ("operator", *op); cli.entity ("operator", *op);
}
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -770,10 +735,11 @@ void Context::decomposeSortField (
// Note: The reason some of these are commented out is because the ::clear // Note: The reason some of these are commented out is because the ::clear
// method is not really "clear" but "clear_some". Some members do not need to // method is not really "clear" but "clear_some". Some members do not need to
// be initialized. That makes this method something of a misnomer. So be it. // be initialized. That makes this method something of a misnomer. So be it.
//
// TODO Is this method used anywhere?
void Context::clear () void Context::clear ()
{ {
tdb2.clear (); tdb2.clear ();
parser.clear ();
// Eliminate the command objects. // Eliminate the command objects.
std::map <std::string, Command*>::iterator com; std::map <std::string, Command*>::iterator com;
@ -833,10 +799,7 @@ void Context::loadAliases ()
std::map <std::string, std::string>::iterator i; std::map <std::string, std::string>::iterator i;
for (i = config.begin (); i != config.end (); ++i) for (i = config.begin (); i != config.end (); ++i)
if (i->first.substr (0, 6) == "alias.") if (i->first.substr (0, 6) == "alias.")
{
parser.alias (i->first.substr (6), i->second);
cli.alias (i->first.substr (6), i->second); cli.alias (i->first.substr (6), i->second);
}
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////