[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jdt-dev] parser question
|
Hey Sebastian,
I looked at that parser implementation a while ago, but at that time is was not even close to the JDT parser when it comes to parsing broken java files and recovering from those broken syntax.
Cheers,
-Martin
> Am 09.03.2019 um 12:31 schrieb Sebastian Kürten <sebastian.kuerten@xxxxxxxxxxxx>:
>
> Hi Martin,
>
> not sure whether it is important to you to use the JDT tools. If not
> you might want to have a look at the JavaParser project[1]. It's a
> Java AST parser written in Java and they also have a module for
> resolving types (they call it symbol solver).
>
> Best,
> Sebastian
>
> [1] https://javaparser.org/
>
> On Fri, 8 Mar 2019 21:12:55 +0100
> Martin Lippert <mlippert@xxxxxxxxx> 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