0

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.

1 Answers1

0

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"); }

monty0
  • 1,759
  • 1
  • 14
  • 22
  • ok friend!!! work ok in tree parsers with rules like {$STRING.token.setText($STRING.text.toUpperCase());} -> (tree rewrite) I will do it in a "java adapter walker", a walker for each target language.. thank you!!! – Diego Martinez Feb 16 '13 at 04:24