Hi all, I've detected a strange behavior of Spirit using (VC9SP1). I assume that chset_p( "-_!#$%&*+|~" ) and chset_p( "!#$%&*+-_|~" ) are identical. I've only changed the order of the characters a little bit. But when i'm trying to parse a string like "abcd-edfg: " the parser eats the ':' sign but shouldn't. Examples here: token_ = alnum_p | chset_p( "-_!#$%&*+|~" ); // the line above works fine token_ = alnum_p | chset_p( "!#$%&*+-_|~" ); // here the ':' sign will be consumed! Thanx.
Commander Pirx wrote:
Hi all,
I've detected a strange behavior of Spirit using (VC9SP1). I assume that Spirit has its own mailing list, which is the best place to post for questions about Spirit.
chset_p( "-_!#$%&*+|~" ) and chset_p( "!#$%&*+-_|~" )
are identical. I've only changed the order of the characters a little bit. But when i'm trying to parse a string like "abcd-edfg: " the parser eats the ':' sign but shouldn't. Examples here:
token_ = alnum_p | chset_p( "-_!#$%&*+|~" );
// the line above works fine
token_ = alnum_p | chset_p( "!#$%&*+-_|~" );
// here the ':' sign will be consumed! Behaviour like that baffled me too at first, but is actually easy to explain: In the first variant chset_p( "-_!#$%&*+|~" ) has the "-" as the first character, so this is fine, it will be treated as "-". The second variant chset_p( "!#$%&*+-_|~" ) has the "-" in the middle, so this is treated as the range from "+" to "_", which assuming you use ascii encompasses the ":" (and a lot of other character from #43 to #95).
HTH, Thomas Taylor
participants (2)
-
Commander Pirx
-
Thomas Taylor