- When a Lexer::typeIdentifier is found, it can be compared to a list of
  other tokens, with the possibility of changing the type. This applies to
  tokens that are longer than the four-character lookahead in the Lexer.
  With this change, the Lexer can now identify all operators supported by Eval,
  and therefore the Lexer can be used on all Eval input expressions. This is
  because all the evaluator needs to know is the distinction between operators
  and operands.
This commit is contained in:
Paul Beckingham 2014-05-26 20:58:10 -04:00
parent 261f86c134
commit b06ac68248
2 changed files with 11 additions and 2 deletions

View file

@ -172,7 +172,7 @@ int Context::initialize (int argc, const char** argv)
for (col = columns.begin (); col != columns.end (); ++col)
parser.entity ("attribute", col->first);
// Entities: Pseudo-attributes.
// Entities: Pseudo-attributes. Hard-coded.
parser.entity ("pseudo", "limit");
// Entities: Modifiers.
@ -191,7 +191,7 @@ int Context::initialize (int argc, const char** argv)
parser.findCommand (); // <cmd>
parser.findUUIDList (); // <uuid> Before findIdSequence
parser.findIdSequence (); // <id>
parser.injectDefaults (); // rc.default.command
parser.injectDefaults (); // rc.default.command
// Static initialization to decouple code.
staticInitialization ();

View file

@ -225,6 +225,15 @@ bool Lexer::token (std::string& token, Type& type)
}
else
{
// typeIdentifier is a catch-all type. Anything word-like becomes an
// identifier. At this point in the processing, an identifier is found,
// and can be matched against a list of potential upgrades.
if (token == "_hastag_" ||
token == "_notag_" ||
token == "_neg_" ||
token == "_pos_")
type = typeOperator;
return true;
}
break;