My input file is having multiple JavaDoc style comments (/** ..... */), I need to read only the very first commented section and skip the rest all commented sections.
Input.txt
/**
@Description("Hi there")
@Input("String")
*/
/**
* This is the a
* commented section that we
* don't want to read.
*/
/**
* This is the another
* commented section that we
* don't want to read.
*/
My Lexer Grammar is as below:-
lexer grammar AnnotationLexer;
ANNOTATION_START
: '/**' -> mode(INSIDE), skip
;
IGNORE
: . -> skip
;
mode INSIDE;
KEY : '@' [a-zA-Z]+ ;
STRING: '"' (~'"' | ',')* '"' ;
ANNOTATION_END
: '*/' -> mode(DEFAULT_MODE), skip
;
IGNORE_INSIDE
: [ \t\r\n] -> skip
mode
when you already seen the first javadoc comment? - Gábor Bakos