12292Re: [antlr-interest] Not able to preserve formatting while saving the file
- Jun 1, 2004This is not the easiest thing to do. Ter's answer using the
TokenStreamRewriteEngine assumes no trees, just a parser pass. There
is another article on preserving whitespace on antlr.org using hidden
token streams and attaching to the tokens.
In the C grammar I think I recorded the column and line info and would
add in the indentation and lines as needed when I was emitting a token
that wasn't at the current position.
On Jun 1, 2004, at 3:33 AM, swift_turtle_male wrote:
> Basically I have made a program, which will analyze the java code and
> suggest optimizations using the antlr tree structure. Now I wanted to
> expand the capabilities of automatically optimizing the existing java
> code, by changing the tree structure. Now Im able to make the
> modifications and save the file, but then I have got a major issue,
> wherein Im not able to preserve the original formatting of the java
> code. Can anyone help me with that ?
> Chunduru Anil Kumar
ANTLR & Java Consultant -- http://www.codetransform.com
ANSI C/GCC transformation toolkit --
Embrace the Decay -- http://www.codetransform.com/EmbraceDecay.html
- << Previous post in topic