New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial support for String Templates, Unnamed Variables, Switch patte… #4357
base: master
Are you sure you want to change the base?
Conversation
I would appreciate any insights if I'm doing something wrong |
Thank you for your hard work, but i can't validate this PR because it mixes several concepts and doesn't take into account all the JP components (for example, I can't see anything about the LPP). I suggest you break down the various concepts for which you want to provide a solution, create PRs containing at least the links to the specifications you are implementing, and cover all the JP components for each concept. |
I have no idea what those abrevations are JP (Java Parser?) LPP? Also I have no idea why the tests that are failing are failing. Those tests look really alien to me. I would appreciate any insights. The approach of implementing some features instead of the full suit is that to give a ground for other contributors to jump in and polish stuff. The project is far behind in terms so I think we can get it up to date as a community. Unfotunately my time is very limited and I have no idea when I will have a spare weekend to work on this. About the generated part... I reverse enginered it. Tests prove that the code is doing what it is expected to. |
@binis2 I've started looking into adding java21 support and what you've done here looks great! The company I work for uses JavaParser, so I have a decent chunk of time to work on this now. I'd be happy to collaborate on this :) My focus will be on the non-preview features (so switch pattern matching and record patterns), but I see you've already made progress on switch pattern matching. Edit: regarding the LPP, I believe that's the LexicalPreservingPrinter |
@johannescoetzee Yeah I didn't have time to fully implement pattern matching. What's left will be easy to implement when Record Patterns (JEP440) is handled. I'm willing to implement it thou can't say when. If someone can point me on the right direction what should I do for LPP to work it would be great. |
@@ -708,7 +709,7 @@ TOKEN : | |||
( // TODO: Could these escape sequences be extracted out? | |||
"\\" | |||
( | |||
["s","n","t","b","r","f","\\","'","\""] | |||
["s","n","t","b","r","f","\\","'","\"","{"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you add this character here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String Templates. They are escaped like this - STR."{someExpression()}"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the information, I think this change was made in the definition of 'Escape Sequences'. I'm not sure that this is the most appropriate right for this change.
https://docs.oracle.com/javase/specs/jls/se21/html/jls-3.html#jls-3.10.7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String Templates is still preview feature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed a revision with of String Template with it's own matcher
Have you used the generators to generate code for visitors, nodes, etc? (https://javaparser.org/code-generation-and-maven-in-javaparser/) |
No. I wrote them manually. Didn't know there is fast way to do it 😁 |
It seems that the JavaToken discrapancies was the issue with LPP so now all tests are passing. |
…rn matching