I’m working on a Java source code parser, following the lexical and syntactic specifications.
I’m stuck on annotations, though; the relevant rules are:
Annotation:
@ QualifiedIdentifier [ ( [AnnotationElement] ) ]
AnnotationTypeDeclaration:
@ interface Identifier AnnotationTypeBody
but I don’t see the @ symbol mentioned anywhere in the lexical spec. What is the correct rule for tokenizing @, or where can I find such a rule?
I realize that I could easily add a token definition for this, and it might even work — sometimes. But I’d prefer to do it correctly according to the spec if possible.
In 9.6. Annotation Types , it says: