Expectation failure not triggered if file ends with Boost Spirit Qi parser -


when file ends in middle of rule remaining expectations, doesn't trigger expectation error (it does, of course, fail parse).

a simplified example triggers behavior this:

data_var_decls_r   %= (lit("data")        > lit('{'))   > lit('}'); 

if input

data { 

then expectation error final expected } isn't triggered.

is there way deal expectation errors extend past end of file?

making self-contained example:

see live on wandbox

#include <boost/spirit/include/qi.hpp>  namespace test {     using namespace boost::spirit::qi;      rule<std::string::const_iterator> rule = lit("data") > '{' > '}'; }  int main() {     std::string const input("data{");      bool ok = parse(input.begin(), input.end(), test::rule); } 

does throw expectation failure.

even when using space skipper, still throws:

see live on wandbox too

#include <boost/spirit/include/qi.hpp>  namespace test {     using namespace boost::spirit::qi;      rule<std::string::const_iterator, space_type> rule = lit("data") > '{' > '}'; }  int main() {     std::string const input("data{");      bool ok = phrase_parse(input.begin(), input.end(), test::rule, test::space); } 

Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -