Using Boost.Spirit, is it possible to deliver a terminal token to multiple actions and if so, what would the syntax be?
For example, suppose I have two rules:
rule 1 that consumes “A B” and has an associated action “void f( <attribute type of A>, <attribute type of B>)” and rule 2 that consumes “B C” and has an associated action “void g( <attribute type of B>, <attribute type of C>)”.
Given the input stream “A1 B1 C1”, I want f(A1,B1) and g(B1,C1) to be invoked.
Edit: Some more research suggests using the And-Predicate may allow this.
Use local variables:
I’m assuming here that lf() and lg() are lazy function (i.e. wrappers for your underlying f() and g()). See here for more information about locals. The disadvantage is that you make a copy of b’s attribute.