In my Boost Spirit grammar, I would like to have a rule that does the following:
rule <...> noCaseLit = no_case [lit ("KEYWORD")];
but for a custom keyword so that I can do this:
... → noCaseLit ("SomeSpecialKeyword") → ... → noCaseLit ("OtherSpecialKeyword1")
Is this possible with Boost Spirit rules, and if so, how?
PS I use the case-insensitive thing as an example, what I do is parameterize the rules in general.
edits: Through the link provided by "sehe" in the comments, I was able to get closer to what I wanted, but I'm not quite there yet.
rule<Iterator, string(string)> noCaseLit = no_case[lit(_r1)]; rule<...> someRule = ... >> noCaseLit(phx::val("SomeSpecialKeyword")) >> ...
I have not figured out a way to automatically convert a literal string to a Phoenix value so that I can use the rule as follows:
rule<...> someRule = ... >> noCaseLit("SomeSpecialKeyword") >> ...
source share