handle invalid command names in action parser (by ignoring them)

This commit is contained in:
Mark Harrah 2011-02-11 20:12:15 -05:00
parent 3895a7cb1e
commit cbdabc1383
1 changed files with 2 additions and 1 deletions

View File

@ -37,7 +37,8 @@ object Act
{
val confMap = confs map { conf => (conf, index.keys(proj, conf)) } toMap;
val allKeys = (Set.empty[String] /: confMap.values)(_ ++ _)
token(ID examples allKeys).flatMap { keyString =>
val filteredKeys = allKeys.filter(Command.validID)
token(ID examples filteredKeys).flatMap { keyString =>
val conf = confMap.flatMap { case (key, value) => if(value contains keyString) key :: Nil else Nil } headOption;
getKey(keyMap, keyString, k => (k, conf.flatMap(identity)))
}