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 Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `CustomErrorListener.ParseIssue` A parse issue (such as an parse error or a parse warning).
    `static class` | `CustomErrorListener.ParseIssueType` Parse issues can be syntax errors, validation errors, and validation warnings.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CustomErrorListener()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `generateParseIssuesMessage(String scriptString, List<CustomErrorListener.ParseIssue> parseIssues)` Generate a message displaying information about the parse issues that occurred.
    `String` | `getCurrentFileName()`
    `List<CustomErrorListener.ParseIssue>` | `getParseIssues()` Obtain the list of parse issues.
    `boolean` | `isAtLeastOneError()`
    `boolean` | `isAtLeastOneWarning()`
    `void` | `setAtLeastOneError(boolean atleastOneError)`
    `void` | `setAtLeastOneWarning(boolean atLeastOneWarning)`
    `void` | `setCurrentFileName(String currentFilePath)`
    `void` | `setParseIssues(List<CustomErrorListener.ParseIssue> parseIssues)` Set the list of parse issues.
    `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.
    `void` | `unsetCurrentFileName()`
    `void` | `validationError(int line, int charPositionInLine, String msg)` Validation error occurred.
    `void` | `validationError(ParseInfo parseInfo, String msg)`
    `void` | `validationWarning(int line, int charPositionInLine, String msg)` Validation warning occurred.

    - ### Methods inherited from class org.antlr.v4.runtime.BaseErrorListener

      `reportAmbiguity, reportAttemptingFullContext, reportContextSensitivity`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CustomErrorListener

          public CustomErrorListener()

  - ### Method Detail

    - #### setCurrentFileName

          public void setCurrentFileName(String currentFilePath)

    - #### getCurrentFileName

          public String getCurrentFileName()

    - #### unsetCurrentFileName

          public void unsetCurrentFileName()

    - #### validationError

          public void validationError(int line,
                                      int charPositionInLine,
                                      String msg)

      Validation error occurred. Add the error to the list of parse issues.
      Parameters:
        `line` - Line number where error was detected
        `charPositionInLine` - Character position where error was detected
        `msg` - Message describing the nature of the validation error

    - #### validationError

          public void validationError(ParseInfo parseInfo,
                                      String msg)

    - #### validationWarning

          public void validationWarning(int line,
                                        int charPositionInLine,
                                        String msg)

      Validation warning occurred. Add the warning to the list of parse issues.
      Parameters:
        `line` - Line number where warning was detected
        `charPositionInLine` - Character position where warning was detected
        `msg` - 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:
        `syntaxError` in interface `org.antlr.v4.runtime.ANTLRErrorListener`
      Overrides:
        `syntaxError` in class `org.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

          public List<CustomErrorListener.ParseIssue> getParseIssues()

      Obtain the list of parse issues.
      Returns:
        The list of parse issues.

    - #### setParseIssues

          public void setParseIssues(List<CustomErrorListener.ParseIssue> parseIssues)

      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.

Copyright © 2020 The Apache Software Foundation. All rights reserved.