> When outputting modified source to a new file, I'f like to
> preserve the
> original formating the
> original source had. This was addressed in post:
> with the code snipet:
> LinkedList list = (LinkedList) Parser.ignoredTokens.getIn(classnode);
> for(Iterator i = list.iterator(); i.hasNext(); )
we use nearly the same source.
LinkedList list = (LinkedList) oParser.ignoredTokens.getIn(node);
if( list != null )
Iterator i = list.iterator();
for(; i.hasNext(); )
It's only reformated for better understanding and the null case.
> About this I have a few questions:
> 1) Location - Where would be the best place for this code snipet?
We place it in the defaultCase statement. Because we use it in a pretty printer
it should work for you as well.
> 2) How is a static reference to a non-static variable supposed to work
> Doesn't each instance of Parser have it's own ignoredTokens?
Well I guess you tell the parser by the node paramter what you want.
Doesn't matter much if the Parser is static then. Because each node
knows what ignored tokens were placed before it.