Expressions reboot

- Created A3.{h,cpp} which will be a simpler, lightweight version of
  Arguments.{h,cpp} that does less, but does it better.
- Created E9.{h,cpp} which will be a better implementation of
  Expression.{h,cpp} that does less, but does it better.
- Integrated A3 into Context::initialize, and Arguments and A3 will
  coexist until A3 surpasses Arguments.
This commit is contained in:
Paul Beckingham 2011-07-23 13:38:33 -04:00
parent 1164ea5cf1
commit 5b5978952a
8 changed files with 2839 additions and 14 deletions

View file

@ -73,8 +73,8 @@ int Context::initialize (int argc, const char** argv)
try
{
// char** argv --> std::vector <std::string> Context::args.
// TODO Handle "cal" case here.
args.capture (argc, argv);
a3.capture (argc, argv);
// echo one two -- three | task zero --> task zero one two
// 'three' is left in the input buffer.
@ -122,6 +122,9 @@ int Context::initialize (int argc, const char** argv)
// Categorize all arguments one more time. THIS IS NECESSARY.
args.categorize ();
a3.categorize ();
a3.dump ("Initial"); // TODO Remove.
// Handle default command and assumed 'info' command.
args.inject_defaults ();
@ -283,7 +286,7 @@ int Context::dispatch (std::string &out)
tdb2.gc ();
}
args.dump ("Argument Categorization");
// args.dump ("Argument Categorization");
return c->execute (out);
}
@ -422,6 +425,17 @@ const std::vector <std::string> Context::getColumns () const
return output;
}
////////////////////////////////////////////////////////////////////////////////
const std::vector <std::string> Context::getCommands () const
{
std::vector <std::string> output;
std::map <std::string, Command*>::const_iterator i;
for (i = commands.begin (); i != commands.end (); ++i)
output.push_back (i->first);
return output;
}
////////////////////////////////////////////////////////////////////////////////
void Context::assumeLocations ()
{