Class SyntaxError

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
EOFError

public class SyntaxError extends RuntimeException
Exception thrown when a syntax error is encountered during parsing.

SyntaxError is thrown by the Parser when it encounters invalid syntax in the input line. It provides information about the location of the error (line and column) and a descriptive message about the nature of the error.

This exception is typically caught by the LineReader, which may then display an error message to the user or take other appropriate action based on the parsing context.

The EOFError subclass is used specifically for incomplete input errors, such as unclosed quotes or brackets, which might be completed by additional input.

See Also:
  • Constructor Details

    • SyntaxError

      public SyntaxError(int line, int column, String message)
  • Method Details

    • column

      public int column()
      Returns the column position where the syntax error occurred.
      Returns:
      the column position (0-based index)
    • line

      public int line()
      Returns the line number where the syntax error occurred.
      Returns:
      the line number (0-based index)