[antlr-interest] Extensions which I have found useful
phreed at gmail.com
Fri Feb 1 10:02:13 PST 2008
A couple of items which I have found useful in the development of an
IDL parser (with constraints).
For StringTemplates, provide a toSubList(List list, String formatName)
method in AttributeRenderer similar to its toString(Object obj, String
The toSubList() method would provide formatting of attribute lists.
(I can explain the scenario where this was needed if you care.)
The method is useful when the order, position, presence of elements in
a list attribute need to be changed prior to formatting its elements.
This could be generalized to include the 'separator' argument.
At present the toSubList() method is called from the model prior to
invoking the template.
I believe that it would be more appropriate to perform this formatting
in the view (i.e. template).
Modify the *Walker.input to be a stack rather than a single variable.
Then similar to what is done with scope, allow the position in the AST
to be changed (input = new CommonTreeNodeStream(subtree)) as the rule
(In my current implementation the subtree is obtained from a symbol table.)
Normally, a preparatory pass through the AST to augment the symbol
table with the relevant information would be performed but that makes
the association less clear.
Conceptually, the input stack provides a way to "lazily" augment the
More information about the antlr-interest