[Spirit] Grammar rule problem

Hello,
I'm writing a configuration file parser with boost::spirit, and have
encountered some strange errors. The errors are:
1) error C2078: too many initializers (in file assign_actor.hpp, line 62)
2) error C2440: 'initializing' : cannot convert from 'const iterator_t ' to
'value_type' (in file assign_actor.hpp, line 62)
The line that's causing the error is identical (in concept) to the one
above. Why is it generating an error? The code I'm using is below. Rule
"two" is generating the error.
#include <iostream>
#include

On Fri, Oct 30, 2009 at 9:30 AM, Dylan Klomparens
Hello,
I'm writing a configuration file parser with boost::spirit, and have encountered some strange errors. The errors are:
1) error C2078: too many initializers (in file assign_actor.hpp, line 62)
2) error C2440: 'initializing' : cannot convert from 'const iterator_t ' to 'value_type' (in file assign_actor.hpp, line 62)
The line that's causing the error is identical (in concept) to the one above. Why is it generating an error? The code I'm using is below. Rule "two" is generating the error.
#include <iostream> #include
using namespace std; int main() { using namespace boost::spirit; const int UnsignedCharacterMaximum = (numeric_limits<unsigned char>::max)(); const int UnsignedShortMaximum = (numeric_limits<unsigned short>::max)(); rule<> octet_p = limit_d(0, UnsignedCharacterMaximum)[int_p]; rule<> ip_address_p = octet_p >> ch_p('.') >> octet_p >> ch_p('.') >> octet_p >> ch_p('.') >> octet_p; rule<> network_port_p = limit_d(0, UnsignedShortMaximum - 1)[int_p];
string s; int i; rule<> one = ip_address_p[assign_a(s)]; rule<> two = network_port_p[assign_a(i)]; // Commenting this line gets rid of the error. // But this line should work. It is identical (in conecpt) to the previous line.
cout << parse("192.168.0.1", one).full << endl;
return 0; }
You should post Spirit questions to the Spirit list.
Based on your code you are using the old Spirit.Classic, I do not know
enough about it to say, however in Spirit.Qi (the latest version), I
would do it like this:
uint_parser
participants (2)
-
Dylan Klomparens
-
OvermindDL1