title: Boost::Spirit - on_error not printing
body: <p>I'm trying to use the <code>on_error</code> mechanism of Boost::Spirit::qi to find out why the parsing failed.  </p>
  
  <p>I've set a breakpoint at the <code>on_error</code> function and the function is being called, but no output (nada, nothing, void, ...).  </p>
  
  <p>The simple <code>on_error</code>:  </p>
  
  <pre><code>on_error&lt;fail&gt;(level1,
      boost::phoenix::ref(std::cout) &lt;&lt; "I've failed.\n"
      );
  </code></pre>
  
  <p>The complex <code>on_error</code> (from various sites):  </p>
  
  <pre><code>on_error&lt;fail&gt;
  (
      start,
      boost::phoenix::ref(std::cout)
          &lt;&lt; val("Error! Expecting ")
          &lt;&lt; _4
          &lt;&lt; val(" here: \"")
          &lt;&lt; construct&lt;std::string&gt;(qi::_3, qi::_2)
          &lt;&lt; val("\"")
          &lt;&lt; std::endl
      );
  </code></pre>
  
  <p>Here is my class containing the simple <code>on_error</code>:  </p>
  
  <pre><code>template &lt;typename Iterator, typename Skipper&gt;
  struct Event_Compound
      : qi::grammar&lt;Iterator, Skipper&gt;
  {
      Event_Compound () 
          : Event_Compound::base_type(start, "Compound-Event")
          {
              using qi::lexeme;
              using qi::lit;
              using namespace qi;
              using boost::spirit::ascii::char_;
  
              relational_operator =
                  lit("&amp;&amp;")[Matched_Relational_AND]
                  || lit("||")[Matched_Relational_OR]
                  ;
  
              compound =
                  level1[Matched_Nested_Level1_Begin] &gt;&gt; relational_operator[Matched_Relational_Operator] &gt;&gt; level1[Matched_Nested_Level1_End]
                  ;
  
              compare_or_compound =
                  compound[Matched_Compound] | grammar_comparison_event[Matched_Comparison_Event]
                  ;
  
              level1 =
                  grammar_boolean_event[Matched_Boolean_Event]
                  | ( char_('(')[Matched_Open_Paren] &gt;&gt; compare_or_compound[Matched_Compare_Or] &gt;&gt; char_(')')[Matched_Close_Paren]  )
                  ;
  
              start =
                  level1[Matched_Level1_Begin] &gt;&gt; relational_operator[Matched_Relational_Operator] &gt;&gt; level1[Matched_Level1_End]
                  ;
              on_error&lt;fail&gt;(level1,
                  boost::phoenix::ref(std::cout) &lt;&lt; "I've failed.\n"
                  );
          }
  
      Event_Boolean&lt;Iterator, Skipper&gt;        grammar_boolean_event;
      Event_Comparison&lt;Iterator, Skipper&gt;     grammar_comparison_event;
      qi::rule&lt;Iterator, Skipper&gt;             level1;
      qi::rule&lt;Iterator, Skipper&gt;             compound;
      qi::rule&lt;Iterator, Skipper&gt;             compare_or_compound;
      qi::rule&lt;Iterator, Skipper&gt;             relational_operator;
      qi::rule&lt;Iterator, Skipper&gt;             start;
  };
  </code></pre>
  
  <p>Is there a <em>simple</em> method to trace the behavior or thinking pattern of the parser? (Such as setting a preprocessor macro or some flag variable)  </p>
  
  <p>Why isn't there any output from the <code>on_error</code>?  </p>
  
  <p>Also, what do <code>_1, _2, _3</code> and <code>_4</code> reference?  </p>
  
  <p>I'm trying to debug a grammar and I have output as to the rules that have been matched, but when a rule isn't matched, I want to know which rule and why.  </p>
  
  <p>I'm using:  </p>
  
  <ul>
  <li>Boost 1.57.0</li>
  <li>Visual Studio 2010</li>
  <li>Windows 7</li>
  </ul>
  
  <p>Researched:  </p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/19375766/how-to-make-error-handling-work-for-boostspirit">how to make error handling work for
  boost::spirit</a>  </li>
  <li><a href="http://boost-spirit.com/home/2011/02/28/dispatching-on-expectation-point-failures/comment-page-1/" rel="nofollow noreferrer">Dispatching on Expectation
  Failures</a></li>
  <li><a href="http://www.boost.org/doc/libs/1_41_0/libs/spirit/doc/html/spirit/qi/tutorials/mini_xml___error_handling.html" rel="nofollow noreferrer">Boost::Spirit documentation: Mini XML - Error
  Handling</a></li>
  </ul>