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
Fields Modifier and Type Field Description private JavadocDetailNodeParser.ParseErrorMessage
errorMessage
Error message that appeared while parsing.private int
offset
Offset is line number of beginning of the Javadoc comment.
-
Constructor Summary
Constructors Modifier Constructor Description private
DescriptiveErrorListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private JavadocDetailNodeParser.ParseErrorMessage
getErrorMessage()
Getter 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.
-
-
-
Field Detail
-
offset
private int 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
private JavadocDetailNodeParser.ParseErrorMessage errorMessage
Error message that appeared while parsing.
-
-
Constructor Detail
-
DescriptiveErrorListener
private DescriptiveErrorListener()
-
-
Method Detail
-
getErrorMessage
private JavadocDetailNodeParser.ParseErrorMessage getErrorMessage()
Getter for error message during parsing.- Returns:
- Error message during parsing.
-
setOffset
public void setOffset(int offset)
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
-
-