Bug - Tag Recognition

- Lowered the precedence of tag detection so that dates and durations are
  recognized first.
- Modified the allowable tokens for a tag to be almost anything.
This commit is contained in:
Paul Beckingham 2011-09-08 22:49:58 -04:00
parent 8cd1efd609
commit 38c325d469

View file

@ -712,13 +712,6 @@ const A3 A3::tokenize (const A3& input) const
found_something_after_sequence = true; found_something_after_sequence = true;
} }
else if (is_tag (n, s))
{
output.push_back (Arg (s, Arg::cat_tag));
if (found_sequence)
found_something_after_sequence = true;
}
// Must be higher than number. // Must be higher than number.
// Must be higher than operator. // Must be higher than operator.
// Note that Nibbler::getDate does not read durations. // Note that Nibbler::getDate does not read durations.
@ -738,6 +731,13 @@ const A3 A3::tokenize (const A3& input) const
found_something_after_sequence = true; found_something_after_sequence = true;
} }
else if (is_tag (n, s))
{
output.push_back (Arg (s, Arg::cat_tag));
if (found_sequence)
found_something_after_sequence = true;
}
else if (n.getOneOf (operators, s)) else if (n.getOneOf (operators, s))
{ {
output.push_back (Arg (s, Arg::cat_op)); output.push_back (Arg (s, Arg::cat_op));
@ -1662,10 +1662,8 @@ bool A3::is_tag (Nibbler& n, std::string& result)
if (n.skipAllOneOf ("+-")) if (n.skipAllOneOf ("+-"))
{ {
n.skipAllOneOf ("@#");
std::string name; std::string name;
if (n.getName (name) && if (n.getUntilOneOf (" \t()+-*/", name) &&
name.length ()) name.length ())
{ {
std::string::size_type end = n.cursor (); std::string::size_type end = n.cursor ();