mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Parser
- ::initialize now lexes all args up front.
This commit is contained in:
parent
1b8671b58e
commit
0500649992
1 changed files with 17 additions and 2 deletions
|
@ -76,10 +76,26 @@ void Parser::initialize (int argc, const char** argv)
|
|||
// Create top-level nodes.
|
||||
for (int i = 0; i < argc; ++i)
|
||||
{
|
||||
std::string raw = argv[i];
|
||||
Tree* branch = _tree->addBranch (new Tree (format ("arg{1}", i)));
|
||||
branch->attribute ("raw", argv[i]);
|
||||
branch->attribute ("raw", raw);
|
||||
branch->tag ("ORIGINAL");
|
||||
branch->tag ("?");
|
||||
|
||||
std::vector <std::pair <std::string, Lexer::Type> > lexemes;
|
||||
Lexer::token_split (lexemes, raw);
|
||||
|
||||
std::vector <std::pair <std::string, Lexer::Type> >::iterator lex;
|
||||
for (lex = lexemes.begin (); lex != lexemes.end (); ++lex)
|
||||
{
|
||||
Tree* sub = branch->addBranch (new Tree ("argSub"));
|
||||
sub->attribute ("raw", lex->first);
|
||||
|
||||
if (lex->second == Lexer::typeOperator)
|
||||
sub->tag ("OP");
|
||||
|
||||
// TODO More types needed.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,7 +182,6 @@ Tree* Parser::parse ()
|
|||
findMissingOperators ();
|
||||
|
||||
validate ();
|
||||
|
||||
return _tree;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue