In your parser you could set the text of the Token, and that should flow through to the StringTemplate. Something like this grammar fragment should work:
my=MY_FIELD { $my.setText("myField"); }
Frage
What is the best pattern (language independent, for retargetable generation code) to translate antlr token to camel case StringTemplate attribute in a tree conversion? Example: My DSL has MY_FIELD definition and in the StringTemplate output I need myField.
Lösung
In your parser you could set the text of the Token, and that should flow through to the StringTemplate. Something like this grammar fragment should work:
my=MY_FIELD { $my.setText("myField"); }