com.puppycrawl.tools.checkstyle.grammars.javadoc.JavadocLexer.g4 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of checkstyle Show documentation
Show all versions of checkstyle Show documentation
Checkstyle is a development tool to help programmers write Java code
that adheres to a coding standard
lexer grammar JavadocLexer;
@lexer::header {
import java.util.*;
}
@lexer::members {
boolean recognizeXmlTags = true;
boolean isJavadocTagAvailable = true;
int insideJavadocInlineTag = 0;
boolean insidePreTag = false;
boolean referenceCatched = false;
boolean insideReferenceArguments = false;
boolean htmlTagNameCatched = false;
boolean attributeCatched = false;
int previousTokenType = 0;
int previousToPreviousTokenType = 0;
public void emit(Token token) {
super.emit(token);
previousToPreviousTokenType = previousTokenType;
previousTokenType = token.getType();
if (previousTokenType == NEWLINE) {
isJavadocTagAvailable = true;
} else if (previousTokenType != WS && previousTokenType != LEADING_ASTERISK) {
isJavadocTagAvailable = false;
}
}
public void skipCurrentTokenConsuming() {
_input.seek(_input.index() - 1);
}
}
LEADING_ASTERISK : ( (' '|'\t') {_tokenStartCharPositionInLine == 0}? ) (' '|'\t')* '*'
| '*' {_tokenStartCharPositionInLine == 0}?
;
HTML_COMMENT_START : '' -> mode(DEFAULT_MODE);
LeadingAst: LEADING_ASTERISK -> type(LEADING_ASTERISK);
Newline6: NEWLINE -> type(NEWLINE);
WhiteSpace: WS -> type(WS);
CommentChar: . -> type(CHAR);