In the Spirit library, it is possible to assign a separate parser_id to a rule as one of the template parameters for the rule. This rule can then be extracted from, for example, AST trees to determine which rule created a match. In theory, this is great, since it allows some decoupling between the rule definitions and the AST tree interpretation. However, if you create two rules A and B with different parser IDs (say 1 and 2), and then you call A = B, then both A and B will have an ID of 2.

 

I assume this is a bug. Is it a known bug? If so, what is the fix?

 

If it’s not a bug, then what the heck is the point of it, and how does one work around it?

 

Thanks!

 

-Fred