diff --git a/src/CLI.cpp b/src/CLI.cpp
index dcbe1051a..bf13969b0 100644
--- a/src/CLI.cpp
+++ b/src/CLI.cpp
@@ -294,7 +294,8 @@ const std::string CLI::getFilter ()
unsweetenTags ();
unsweetenAttributes ();
unsweetenAttributeModifiers ();
- // TODO all the other types: pattern, id, uuid ...
+ unsweetenPatterns ();
+ // TODO all the other types: id, uuid ...
std::string filter = "";
if (_args.size ())
@@ -801,6 +802,43 @@ void CLI::unsweetenAttributeModifiers ()
_args = reconstructed;
}
+////////////////////////////////////////////////////////////////////////////////
+// /pattern/ --> description ~ pattern
+void CLI::unsweetenPatterns ()
+{
+ std::vector reconstructed;
+ std::vector ::iterator a;
+ for (a = _args.begin (); a != _args.end (); ++a)
+ {
+ Nibbler n (a->attribute ("raw"));
+ std::string pattern;
+
+ if (n.getQuoted ('/', pattern) &&
+ n.depleted () &&
+ pattern.length () > 0)
+ {
+ A lhs ("argPattern", "description");
+ lhs.tag ("ATT");
+ lhs.tag ("FILTER");
+ reconstructed.push_back (lhs);
+
+ A op ("argPattern", "~");
+ op.tag ("OP");
+ op.tag ("FILTER");
+ reconstructed.push_back (op);
+
+ A rhs ("argPattern", "'" + pattern + "'");
+ rhs.tag ("LITERAL");
+ rhs.tag ("FILTER");
+ reconstructed.push_back (rhs);
+ }
+ else
+ reconstructed.push_back (*a);
+ }
+
+ _args = reconstructed;
+}
+
////////////////////////////////////////////////////////////////////////////////
void CLI::dump (const std::string& label) const
{
diff --git a/src/CLI.h b/src/CLI.h
index cbf70dbfa..fafe74d29 100644
--- a/src/CLI.h
+++ b/src/CLI.h
@@ -79,6 +79,7 @@ private:
void unsweetenTags ();
void unsweetenAttributes ();
void unsweetenAttributeModifiers ();
+ void unsweetenPatterns ();
void dump (const std::string&) const;
public: