title: Boost::spirit does not recognize an optional expression
body: <p>I am learning how to use <a href="http://www.boost.org/doc/libs/1_52_0/libs/spirit/doc/html/index.html" rel="nofollow">boost::spirit</a> and I am facing some problems even with quite simple parsers. I am trying to construct a parser that accepts a list of digits (only 0 or 1) separated by colons. The list can have 3 or 4 digits. Thus, <code>0:0:0</code> and <code>1:0:1:0</code> are valid, while for instance <code>0:0</code> or <code>0:0:0:0:0</code> are not.</p>
  
  <p>In the following code you can see how I used the optional operator to specify that the first digit may exist or not. It, however, does not work (parsing fails for sequence <code>0:0:0</code>). Is there anything wrong in the code? I would say it is correct, but again, I just started learning Spirit.</p>
  
  <pre><code>#include &lt;boost/spirit/include/qi.hpp&gt;
  
  namespace qi = boost::spirit::qi;
  namespace phoenix = boost::phoenix;
  
  void parse_tuple(const std::string&amp; tuple) {
      using qi::char_;
  
      auto begin = tuple.begin();
      auto end = tuple.end();
  
      bool r = qi::parse(begin, end,
              -(char_('0', '1') &gt;&gt; ':') &gt;&gt; 
                char_('0', '1') &gt;&gt; ':' &gt;&gt;
                char_('0', '1') &gt;&gt; ':' &gt;&gt;
                char_('0', '1')
              );
      if (!r || begin != end)
          throw std::runtime_error("wrong format");
  }
  
  int main() {
      parse_tuple("0:0:0"); // It fails for this one
      parse_tuple("0:0:0:0");
  
      try { parse_tuple("0:0"); } catch (...) {
          std::cout &lt;&lt; "expected error\n"; }
      try { parse_tuple("0:0:0:0:0"); } catch (...) {
          std::cout &lt;&lt; "expected error\n"; }
  }
  </code></pre>