Package com.puppycrawl.tools.checkstyle
Class JavadocDetailNodeParser.DescriptiveErrorListener
java.lang.Object
org.antlr.v4.runtime.BaseErrorListener
com.puppycrawl.tools.checkstyle.JavadocDetailNodeParser.DescriptiveErrorListener
- All Implemented Interfaces:
org.antlr.v4.runtime.ANTLRErrorListener
- Enclosing class:
- JavadocDetailNodeParser
private static final class JavadocDetailNodeParser.DescriptiveErrorListener
extends org.antlr.v4.runtime.BaseErrorListener
Custom error listener for JavadocParser that prints user readable errors.
-
Field Summary
FieldsModifier and TypeFieldDescriptionError message that appeared while parsing.private int
Offset is line number of beginning of the Javadoc comment. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGetter for error message during parsing.void
setOffset
(int offset) Sets offset.void
syntaxError
(org.antlr.v4.runtime.Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, org.antlr.v4.runtime.RecognitionException ex) Logs parser errors in Checkstyle manner.Methods inherited from class org.antlr.v4.runtime.BaseErrorListener
reportAmbiguity, reportAttemptingFullContext, reportContextSensitivity
-
Field Details
-
offset
Offset is line number of beginning of the Javadoc comment. Log messages should have line number in scope of file, not in scope of Javadoc comment. -
errorMessage
Error message that appeared while parsing.
-
-
Constructor Details
-
DescriptiveErrorListener
private DescriptiveErrorListener()
-
-
Method Details
-
getErrorMessage
Getter for error message during parsing.- Returns:
- Error message during parsing.
-
setOffset
Sets offset. Offset is line number of beginning of the Javadoc comment. Log messages should have line number in scope of file, not in scope of Javadoc comment.- Parameters:
offset
- offset line number
-
syntaxError
public void syntaxError(org.antlr.v4.runtime.Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, org.antlr.v4.runtime.RecognitionException ex) Logs parser errors in Checkstyle manner. Parser can generate error messages. There is special error that parser can generate. It is missed close HTML tag. This case is special because parser prints error like"no viable alternative at input 'b \n *\n'"
and it is not clear that error is about missed close HTML tag. Other error messages are not special and logged simply as "Parse Error...".- Specified by:
syntaxError
in interfaceorg.antlr.v4.runtime.ANTLRErrorListener
- Overrides:
syntaxError
in classorg.antlr.v4.runtime.BaseErrorListener
-