TW-1652: task rm misparsed

- Thanks to Daniel Shahaf.
This commit is contained in:
Paul Beckingham 2015-08-07 19:33:27 -04:00
parent bbb0ac3d29
commit 38500fd90b
5 changed files with 34 additions and 15 deletions

View file

@ -854,11 +854,11 @@ void CLI2::aliasExpansion ()
}
else if (_aliases.find (raw) != _aliases.end ())
{
for (auto& l : Lexer::split (_aliases[raw]))
{
A2 a (l, Lexer::Type::word);
reconstructed.push_back (a);
}
std::string lexeme;
Lexer::Type type;
Lexer lex (_aliases[raw]);
while (lex.token (lexeme, type))
reconstructed.push_back (A2 (lexeme, type));
action = true;
changes = true;
@ -884,8 +884,11 @@ void CLI2::aliasExpansion ()
}
else if (_aliases.find (i) != _aliases.end ())
{
for (auto& l : Lexer::split (_aliases[i]))
reconstructedOriginals.push_back (l);
std::string lexeme;
Lexer::Type type;
Lexer lex (_aliases[i]);
while (lex.token (lexeme, type))
reconstructedOriginals.push_back (lexeme);
action = true;
changes = true;

View file

@ -1115,7 +1115,7 @@ bool Lexer::isDOM (std::string& token, Lexer::Type& type)
std::size_t checkpoint = _cursor;
// [prefix]tags.<word>
if (isLiteral ("tags", true, false) &&
if (isLiteral ("tags", false, false) &&
isLiteral (".", false, false) &&
isWord (partialToken, partialType))
{
@ -1127,7 +1127,7 @@ bool Lexer::isDOM (std::string& token, Lexer::Type& type)
_cursor = checkpoint;
// [prefix]attribute
if (isOneOf (attributes, true, true))
if (isOneOf (attributes, false, true))
{
token = _text.substr (marker, _cursor - marker);
type = Lexer::Type::dom;
@ -1135,7 +1135,7 @@ bool Lexer::isDOM (std::string& token, Lexer::Type& type)
}
// [prefix]attribute.
if (isOneOf (attributes, true, false))
if (isOneOf (attributes, false, false))
{
if (isLiteral (".", false, false))
{
@ -1146,7 +1146,7 @@ bool Lexer::isDOM (std::string& token, Lexer::Type& type)
isOneOf ({"year", "month", "day",
"week", "weekday",
"julian",
"hour", "minute", "second"}, true, true))
"hour", "minute", "second"}, false, true))
{
token = _text.substr (marker, _cursor - marker);
type = Lexer::Type::dom;
@ -1171,24 +1171,24 @@ bool Lexer::isDOM (std::string& token, Lexer::Type& type)
{
if (isLiteral (".", false, false))
{
if (isLiteral ("description", true, true))
if (isLiteral ("description", false, true))
{
token = _text.substr (marker, _cursor - marker);
type = Lexer::Type::dom;
return true;
}
else if (isLiteral ("entry", true, true))
else if (isLiteral ("entry", false, true))
{
token = _text.substr (marker, _cursor - marker);
type = Lexer::Type::dom;
return true;
}
else if (isLiteral ("entry", true, false) &&
else if (isLiteral ("entry", false, false) &&
isLiteral (".", false, false) &&
isOneOf ({"year", "month", "day",
"week", "weekday",
"julian",
"hour", "minute", "second"}, true, true))
"hour", "minute", "second"}, false, true))
{
token = _text.substr (marker, _cursor - marker);
type = Lexer::Type::dom;