[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jdt-dev] parser question
|
Hi Martin,
Do you need errors and warnings to be reported?
Reason for asking: some problems are detected as late as during code generation.
If you don't need those problems, it should theoretically be possible to skip
code generation, but this option exists only in internal API. If you need this
option exposed in public API and if you have numbers confirming that time is
unnecessarily burnt during code gen, the an enhancement request in bugzilla
could make sense.
Stephan
PS:
> I found this:
> org.eclipse.jdt.internal.compiler.parser.Parser
> but I have no idea how to use that or how to configure that to generate an
AST from source files.
You probably saw the word "internal" in the package name? :)
That's exactly what org.eclipse.jdt.core.dom.* encapsulates.
On 08.03.19 21:12, Martin Lippert wrote:
Hey!
I need to create ASTs (incl. type resolving) for Java source files (outside of an Eclipse project environment, just plain Java and some source files).
At the moment I am using:
ASTParser parser = ASTParser.newParser(AST.JLS11);
This works nicely, but I need to get ASTs for method bodies, so I configured the parser to NOT ignore method bodies. But this causes the parser to somehow call out to a compiler to generate bytecode - which I don’t need at all for my purpose. I am interested in the resolved AST only, no byte code necessary. Since this piece of the code is extremely sensitive to performance and memory footprint issues, I am looking into this.
Is there an alternative to this approach to avoid the bytecode generation?
I found this:
org.eclipse.jdt.internal.compiler.parser.Parser
but I have no idea how to use that or how to configure that to generate an AST from source files.
Can you shed some light on this? Any examples how to re-use this parser for generating ASTs (without bytecode generation)?
Thanks so much for your help!
-Martin
_______________________________________________
jdt-dev mailing list
jdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/jdt-dev