Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » AST Tutorial
AST Tutorial [message #157662] Thu, 06 May 2004 19:58 Go to next message
Eclipse UserFriend
Originally posted by: acr.ai.sri.com

Hello,

I am trying (or would like to, I should say) to use AST to parse some
Java files and translate them into another language. I do not want to
write a plugin, I just want to use the API to create the necesary syntax
trees and move on from there. Can you recommend on how to get started?
So far I am getting teh following error from JavaCore, which I assumes
comes from the fact that I am not inside a plugin:

java.lang.NullPointerException
at org.eclipse.jdt.core.JavaCore.getDefaultOptions(JavaCore.jav a:1987)
at org.eclipse.jdt.core.dom.AST.<init>(AST.java:122)
at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:1 081)
at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:1 026)
at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:1 016)
at acr.Foo.main(Foo.java:21)
Exception in thread "main"

Thanks for your help.


Andres C. Rodriguez
Re: AST Tutorial [message #157671 is a reply to message #157662] Thu, 06 May 2004 21:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: olivier_thomannNO.ca.ibm.comSPAM

Le Thu, 06 May 2004 16:58:17 -0700, "Andres C. Rodriguez"
<acr@ai.sri.com> a écrit :
>trees and move on from there. Can you recommend on how to get started?
> So far I am getting teh following error from JavaCore, which I assumes
>comes from the fact that I am not inside a plugin:
>java.lang.NullPointerException
>at org.eclipse.jdt.core.JavaCore.getDefaultOptions(JavaCore.jav a:1987)
>at org.eclipse.jdt.core.dom.AST.<init>(AST.java:122)
>at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:1 081)
>at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:1 026)
>at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:1 016)
>at acr.Foo.main(Foo.java:21)
>Exception in thread "main"
Yes, this comes from the fact that your are not in a plugin. In order
to get the JavaCore options, you need to activate the JDT/Core plugin.

You can look at the dom tests in order to see how to manipulate the
DOM node.
--
Olivier
Re: AST Tutorial [message #157787 is a reply to message #157671] Fri, 07 May 2004 15:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: acr.ai.sri.com

And how do I do that? Or where can I look for information on how to do
this? Thanks.


> Yes, this comes from the fact that your are not in a plugin. In order
> to get the JavaCore options, you need to activate the JDT/Core plugin.
>
> You can look at the dom tests in order to see how to manipulate the
> DOM node.
Re: AST Tutorial [message #157813 is a reply to message #157787] Fri, 07 May 2004 16:29 Go to previous message
Eclipse UserFriend
Originally posted by: olivier_thomannNO.ca.ibm.comSPAM

Le Fri, 07 May 2004 12:18:04 -0700, "Andres C. Rodriguez"
<acr@ai.sri.com> a écrit :
>And how do I do that? Or where can I look for information on how to do
>this? Thanks.
You need to create a plugin that requires org.eclipse.jdt.core.
--
Olivier
Previous Topic:Losing JRE config in M8
Next Topic:Adding JavaNature to project adds nested folder structure to project
Goto Forum:
  


Current Time: Fri May 02 16:19:33 EDT 2025

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

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

Back to the top