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.

War es hilfreich?

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top