bnaudts Hi Jon
I'd like to post a (pretty obscure) omission in the Java parser: 'this' receiver parameters.
Until yesterday I did not know that they existed,
Wow, that makes two of us! I had no idea that there was such a thing as a receiver parameter. In fact, when I first looked at your message, I thought it was report against the Kotlin parser, where "receiver parameters" is more of a thing.
But I am quite dumbfounded that there is such basic syntax (that has been there since JDK 8!) that occurs absolutely nowhere in the src.zip code. Also, I tend to run the Java parser over practically any Java sources I run across and have never hit an issue with the receiver parameter not being supported. It seems that somebody could be a working Java programmer for decades and not know that this language feature exists!
Claude's patch is quite correct, except that one notes that it writes:
SCAN ReceiverParameter => ReceiverParameter
Claude is smart enough to see that the lookahead is needed (i.e. the default 1-token lookahead would not work) but it doesn't seem to "know" that the idiomatic way of writing this in CongoCC is:
ReceiverParameter =>||
Well, that would be a bit more impressive. Already it is quite impressive, of course. These AI agents drive me crazy because I just don't understand how they work.
Actually, I wrote it a bit differently:
ReceiverParameter
(Annotation)*
Type
[<IDENTIFIER>"."]
"this"
=>||
;
I put the up-to-here at the end of the ReceiverParameter production, and then FormalParameters can be written without the up-to-here, as:
FormalParameters :
"("
[
(ReceiverParameter|FormalParameter)
( "," FormalParameter)*
]
")"
;
It amounts to the same thing, but I find this to be a slightly more elegant way of expressing things. After all, the fact that you have to scan to the end of ReceiverParameter to hit the "this" is more like an implementation detail that is hidden when just reading the FormalParameters production. So it seems like a slightly better way to express it.
I am a bit bothered that we don't have any testcase for this, since our most basic test suite for Java, which is running it over the entirety of src.zip does not work for this bit of Java syntax. If you could point me to the file (from Hibernate apparently) that triggered this, I'll add it to the testfiles directory so that we have a regression test.
Greetings from Chongqing, China
JR