Package org.apache.sysds.parser.dml
Class CustomErrorListener
java.lang.Object
org.antlr.v4.runtime.BaseErrorListener
org.apache.sysds.parser.dml.CustomErrorListener
- All Implemented Interfaces:
org.antlr.v4.runtime.ANTLRErrorListener
public class CustomErrorListener
extends org.antlr.v4.runtime.BaseErrorListener
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassA parse issue (such as an parse error or a parse warning).static enumParse issues can be syntax errors, validation errors, and validation warnings. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgenerateParseIssuesMessage(String scriptString, List<CustomErrorListener.ParseIssue> parseIssues) Generate a message displaying information about the parse issues that occurred.Obtain the list of parse issues.booleanbooleanvoidsetAtLeastOneError(boolean atleastOneError) voidsetAtLeastOneWarning(boolean atLeastOneWarning) voidsetCurrentFileName(String currentFilePath) voidsetParseIssues(List<CustomErrorListener.ParseIssue> parseIssues) Set the list of parse issues.voidsyntaxError(org.antlr.v4.runtime.Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, org.antlr.v4.runtime.RecognitionException e) Syntax error occurred.voidvoidvalidationError(int line, int charPositionInLine, String msg) Validation error occurred.voidvalidationError(ParseInfo parseInfo, String msg) voidvalidationWarning(int line, int charPositionInLine, String msg) Validation warning occurred.Methods inherited from class org.antlr.v4.runtime.BaseErrorListener
reportAmbiguity, reportAttemptingFullContext, reportContextSensitivity
-
Constructor Details
-
CustomErrorListener
public CustomErrorListener()
-
-
Method Details
-
setCurrentFileName
-
getCurrentFileName
-
unsetCurrentFileName
public void unsetCurrentFileName() -
validationError
Validation error occurred. Add the error to the list of parse issues.- Parameters:
line- Line number where error was detectedcharPositionInLine- Character position where error was detectedmsg- Message describing the nature of the validation error
-
validationError
-
validationWarning
Validation warning occurred. Add the warning to the list of parse issues.- Parameters:
line- Line number where warning was detectedcharPositionInLine- Character position where warning was detectedmsg- Message describing the nature of the validation warning
-
syntaxError
public void syntaxError(org.antlr.v4.runtime.Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, org.antlr.v4.runtime.RecognitionException e) Syntax error occurred. Add the error to the list of parse issues.- Specified by:
syntaxErrorin interfaceorg.antlr.v4.runtime.ANTLRErrorListener- Overrides:
syntaxErrorin classorg.antlr.v4.runtime.BaseErrorListener
-
isAtLeastOneError
public boolean isAtLeastOneError() -
setAtLeastOneError
public void setAtLeastOneError(boolean atleastOneError) -
isAtLeastOneWarning
public boolean isAtLeastOneWarning() -
setAtLeastOneWarning
public void setAtLeastOneWarning(boolean atLeastOneWarning) -
getParseIssues
Obtain the list of parse issues.- Returns:
- The list of parse issues.
-
setParseIssues
Set the list of parse issues.- Parameters:
parseIssues- The list of parse issues.
-
generateParseIssuesMessage
public static String generateParseIssuesMessage(String scriptString, List<CustomErrorListener.ParseIssue> parseIssues) Generate a message displaying information about the parse issues that occurred.- Parameters:
scriptString- The DML or PYDML script string.parseIssues- The list of parse issues.- Returns:
- String representing the list of parse issues.
-