Hacking ANTLR3 - preprocess global actions

25 views
Skip to first unread message

Nickolas Pohilets

unread,
Nov 22, 2014, 8:19:59 PM11/22/14
to antlr-di...@googlegroups.com
Hi, all!

I'm using ANTLR3 with custom C++11 target. I'm hacking it here and there to fit my needs. And now I'd like to be able to specify in the grammar file nested C++ namespaces, where generated code should be placed. Idea is to specify namespace like this:
@parser::namespace { Foo::Parser::Generated }
And then target's Java code should split this qualified namespace name into array of string and feed them to string template.
I'm trying to get qualified namespace string from actions dictionary in Grammar object. Naively, I've expected values of the inner dictionary to be String's, but instead I've got instance of GrammarAST. How can I get original string from GrammarAST object?

PS. My target is quite far from production quality, but if somebody wants to take a look on it, I can publish it.
Reply all
Reply to author
Forward
0 new messages