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

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -