AMDG Goran wrote:
I wanna get boost::spirit to tell me which position in my string is liable that parsing fails. Here's a fully compiling demonstration:
#-------------------------------------------------------------------- #include <iostream> #include <string> #include
using namespace std; using namespace boost::spirit;
int main() { string s = "#x"; rule<> r = chlit<>('#') >> chlit<>('X') >> *space_p;
parse_info<> p = parse(s.c_str(),r); if(p.full) cout << "File is OK:\n"; else cout << "Error at pos " << p.length << ".\n";
return 0; } #--------------------------------------------------------------------
With this I get:
Error at pos 4294967295.
But if "string s = "#Xx" I get:
Error at pos 2.
This is what I want. But why do I get 4294967295 which is 2^32-1.
Parsing fails so there is no match. p.length is therefore not valid. In Christ, Steven Watanabe