Reputation: 15085
In spirit::qi
one could pass a parser to a rule as an inherited attribute, and then use it directly:
... >> lazy(_r1) >> ...
Is there any work-around for this in X3?
I can "inject" the parser to the desired rule context using with<state_tag>(std::ref(my_parser))[destination_rule]
, and I can retrieve it within some semantic action later - but I do not realize how to "invoke" it then.
Upvotes: 1
Views: 165
Reputation: 393829
I don't think it's there.
I must admit I simply hack most things with some lambdas returning parsers, but if you truly need to make something that is responsive to the input stream, changing state accordingly, you'll probably want to write a custom X3 parser type.
Note that making custom parser types is surprisingly simple in X3. Baptiste WichtAgustín "K-ballo" Bergé has some examples, and I think I should have them on-site here as well. Let me find some links
Upvotes: 1