Boost logo

Boost :

From: Joel de Guzman (djowel_at_[hidden])
Date: 2003-03-28 17:48:23


Hi Jon,

Ok. I'll ask the tree-people (Dan and Hartmut :-)
This is their domain...

BTW... Please post follow ups to

Spirit-general mailing list
Spirit-general_at_[hidden]
https://lists.sourceforge.net/lists/listinfo/spirit-general

Thanks!

-- 
Joel de Guzman
joel at boost-consulting.com
http://www.boost-consulting.com
http://spirit.sf.net
Jon Wray wrote:
> Sorry, I'm refering tree_node<>::value.id().to_long().  The
> token_node_d directive in the code below creates these nodes, and
> stores the associated rule id in them.  The rule id being stored
> changed when I upgraded to the latest version of Spirit.  Please
> reread my message below with this context in mind.
> 
> Thanks,
> Jon
> 
> -----Original Message-----
> From: Joel de Guzman [mailto:djowel_at_[hidden]]
> Sent: Monday, March 24, 2003 3:58 AM
> To: Boost mailing list
> Subject: Re: [boost] spirit::rule<>::set_id()
> 
> 
> Jon Wray wrote:
>> Thanks!  I noticed that this change leads to different behavior when
>> assigning rules.  Consider this code:
>> 
>>   typename rule_<ScannerT, IDENTIFIER>::type Identifier;
>>   typename rule_<ScannerT, FUNCTION>::type Function;
>>   typename rule_<ScannerT, PREDICATE>::type Predicate;
>>   typename rule_<ScannerT, VARIABLE>::type Variable;
>> 
>>   Identifier = lexeme_d[token_node_d[(alpha_p | '_' | '$') >>
>> *(alnum_p
>>> '_' | '$')]];
>>   Function = Identifier;
>>   Predicate = Identifier;
>>   Variable = Identifier;
>> 
>> value.id().to_long() used to return FUNCTION, PREDICATE, or VARIABLE,
>> but it now returns IDENTIFIER.
> 
> [snip]
> 
> Huh? AFAICT, Function.id() == FUNCTION, Predicate.id() == PREDICATE
> and Variable.id() == VARIABLE.
> 
> I tested this...
> 
>     rule<scanner<>, parser_context, parser_tag<1> > r1;
>     rule<scanner<>, parser_context, parser_tag<2> > r2;
>     r1 = r2;
>     assert(r1.id() == 1);
>     assert(r2.id() == 2);
> 
> What am I missing?

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk