Search code examples
c++boostboost-spiritboost-regex

how to enable traces for Boost Regex and Boost Spirit Lex


How can I enable debugging traces for those libraries such as the traces created by Boost Spirit Qi. It would be useful to get some generated XML files which show me the paths of the underlying states.


Solution

  • I don't think Boost Regex has this. See How do you debug a regex?

    For Boost Spirit you can define

      #define BOOST_SPIRIT_DEBUG
      #define BOOST_SPIRIT_LEXERTL_DEBUG
    

    and a similar one for Lex. The output for Lex is not XML, as I remember, but it does name the state transitions and (obviously) recognized token IDs.

    For an example of how to use BOOST_SPIRIT_DEBUG_NODES see one of my answers

    See also