Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Printing an AST tree
Printing an AST tree [message #271477] Wed, 15 September 2004 12:45 Go to next message
Eclipse UserFriend
Originally posted by: one.two.tree

Hi there,

I'm trying to generate some Java code using AST but I'm having trouble
finding the API to serialize the AST to a .java file.

Any clues?

Thank you!
Re: Printing an AST tree [message #271502 is a reply to message #271477] Wed, 15 September 2004 15:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: olivier_thomannNOSPAM.ca.ibm.com

Oleg Mustiazza wrote:
> Hi there,>
> I'm trying to generate some Java code using AST but I'm having trouble
> finding the API to serialize the AST to a .java file.
>
> Any clues?
You must use Eclipse 3.0 or above and look at the classes in the package
org.eclipse.jdt.core.dom.rewrite. You have code snippets in the javadoc
of these classes.
--
Olivier
Re: Printing an AST tree [message #271515 is a reply to message #271502] Wed, 15 September 2004 16:33 Go to previous message
Eclipse UserFriend
Originally posted by: one.two.tree

Right, but that seems like a cumbersome way to do it, not to mention that it
seems kind of slow too. I must start with an empty document which I have to
first parse, express my type declarations as changes to the empty
compilation unit that I just parsed and then rewrite the original document
(which was empty).

Why cannot I directly start with an AST from scratch and then "write" (not
rewrite) it to a .java file? I don't want to use APIs that tracks changes!

Thanks,
Oleg

"Olivier Thomann" <olivier_thomannNOSPAM@ca.ibm.com> wrote in message
news:cia55h$1nj$1@eclipse.org...
> Oleg Mustiazza wrote:
> > Hi there,>
> > I'm trying to generate some Java code using AST but I'm having trouble
> > finding the API to serialize the AST to a .java file.
> >
> > Any clues?
> You must use Eclipse 3.0 or above and look at the classes in the package
> org.eclipse.jdt.core.dom.rewrite. You have code snippets in the javadoc
> of these classes.
> --
> Olivier
Previous Topic:Alternative to: getPluginClassLoader
Next Topic:Probems due to file persistent property
Goto Forum:
  


Current Time: Sun Nov 09 23:01:56 EST 2025

Powered by FUDForum. Page generated in 1.08288 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top