The OpenJDK javac parser, JavacParser
, massages the lexer tokens GTGTGTEQ
(>>>=
), GTGTEQ
, GTEQ
, GTGTGT
(>>>
) and GTGT
into the token with one less '>
' character when parsing type arguments.
Here is a snippet of the magic from JavacParser#typeArguments()
:
switch (S.token()) {
case GTGTGTEQ:
S.token(GTGTEQ);
break;
case GTGTEQ:
S.token(GTEQ);
break;
case GTEQ:
S.token(EQ);
break;
case GTGTGT:
S.token(GTGT);
break;
case GTGT:
S.token(GT);
break;
default:
accept(GT);
break;
}
One can clearly see that it is indeed a trick, and it's in the grammar :)