jhipster / prettier-java

Prettier Java Plugin
http://www.jhipster.tech/prettier-java/
Apache License 2.0
1.08k stars 103 forks source link

java-parser: New entrypoint `lexAndParse` to return both tokens and CST. #625

Closed max-schaefer closed 10 months ago

max-schaefer commented 10 months ago

What changed with this PR:

Provide an entrypoint that exposes both the CST and the underlying token array.

Alternatives

The token array could also be accessed through the parser object, which we could export instead, but that seems like an internal implementation detail which perhaps shouldn't be part of the API.

Finally, we could consider exporting the lexer, but then if I want to get both the CST and the tokens I have to lex twice, which seems wasteful.

CLAassistant commented 10 months ago

CLA assistant check
All committers have signed the CLA.

DanielFran commented 10 months ago

@max-schaefer can you sign the CLA?

max-schaefer commented 10 months ago

Yep, I'm looking into it (currently checking with my employer whether they are OK with me signing it).

max-schaefer commented 10 months ago

CLA is signed.

clementdessoude commented 10 months ago

Thanks for this addition @max-schaefer !