Arguments

- Corrected mishandling of sequence in both read-only and write
  command filters.
This commit is contained in:
Paul Beckingham 2011-07-09 17:05:25 -04:00
parent 1cb4d19c3c
commit 9b2e61f9b3

View file

@ -1368,7 +1368,8 @@ Arguments Arguments::extract_read_only_filter ()
arg->_third == "pattern" || arg->_third == "pattern" ||
arg->_third == "attr" || arg->_third == "attr" ||
arg->_third == "attmod" || arg->_third == "attmod" ||
arg->_third == "seq" || arg->_third == "id" ||
arg->_third == "uuid" ||
arg->_third == "op" || arg->_third == "op" ||
arg->_third == "exp" || arg->_third == "exp" ||
arg->_third == "word") arg->_third == "word")
@ -1382,8 +1383,11 @@ Arguments Arguments::extract_read_only_filter ()
else else
{ {
// substitution // substitution
throw std::string ("A substitution '") + arg->_first + "' is not allowed " throw std::string ("A ")
"in a read-only command filter."; + arg->_third
+ " '"
+ arg->_first
+ "' is not allowed in a read-only filter.";
} }
} }
@ -1412,7 +1416,8 @@ Arguments Arguments::extract_write_filter ()
} }
// Included regardless of position. // Included regardless of position.
else if (arg->_third == "seq") else if (arg->_third == "id" ||
arg->_third == "uuid")
{ {
filter.push_back (*arg); filter.push_back (*arg);
} }
@ -1462,6 +1467,12 @@ Arguments Arguments::extract_modifications ()
seen_command = true; seen_command = true;
} }
// Sequence excluded regardless of location.
else if (arg->_third == "id" ||
arg->_third == "uuid")
{
}
else if (seen_command) else if (seen_command)
{ {
// Excluded. // Excluded.
@ -1496,6 +1507,7 @@ Arguments Arguments::extract_modifications ()
+ arg->_first + arg->_first
+ "' is not allowed when modifiying a task."; + "' is not allowed when modifiying a task.";
// TODO Really?
else if (arg->_third == "exp") else if (arg->_third == "exp")
throw std::string ("An expression '") throw std::string ("An expression '")
+ arg->_first + arg->_first
@ -1533,11 +1545,13 @@ Arguments Arguments::extract_simple_words ()
} }
// Included. // Included.
else if (arg->_third == "tag" || else if (arg->_third == "tag" ||
arg->_third == "pattern" || arg->_third == "pattern" ||
arg->_third == "seq" || arg->_third == "substitution" ||
arg->_third == "op" || arg->_third == "id" ||
arg->_third == "exp" || arg->_third == "uuid" ||
arg->_third == "op" ||
arg->_third == "exp" ||
arg->_third == "word") arg->_third == "word")
{ {
// "limit" is special - it is recognized but not included in filters. // "limit" is special - it is recognized but not included in filters.
@ -1547,23 +1561,8 @@ Arguments Arguments::extract_simple_words ()
// Error. // Error.
else else
{ throw std::string ("Argument '") + arg->_first + "' is not allowed "
if (arg->_third == "tag") "with this command.";
throw std::string ("A tag '") + arg->_first + "' is not allowed "
"with this command.";
else if (arg->_third == "pattern")
throw std::string ("A pattern '") + arg->_first + "' is not allowed "
"with this command.";
else if (arg->_third == "substitution")
throw std::string ("A substitution '") + arg->_first + "' is not allowed "
"with this command.";
else
throw std::string ("Argument '") + arg->_first + "' is not allowed "
"with this command.";
}
} }
return filter; return filter;