Using boost::spirit, how do I require part of a record to be on its own line?

后端 未结 1 1794
醉梦人生
醉梦人生 2021-02-09 13:31

I have a record parser that throws one of several exceptions to indicate which rule failed.

Front matter:

#include 
#include 

        
1条回答
  •  北恋
    北恋 (楼主)
    2021-02-09 13:56

    Yes, the skipper eats the newline characters. lexeme[eol] doesn't help either because the lexeme directive invokes the skipper before switching to no-skipper mode (see here for more details).

    In order to avoid skipping newlines, either use a different skipper type, or wrap the eol components into no_skip[eol], which is semantically equivalent to lexeme[], except it does not invoke the skipper. Note though, that no_skip[] has been added recently only, so it will be available with the next release only (Boost V1.43). But it is in the Boost SVN already (see here for the preliminary docs).

    0 讨论(0)
提交回复
热议问题