Package: org.codehaus.groovy.syntax

## [Java] Class SyntaxException

- org.codehaus.groovy.syntax.SyntaxException

-     public class SyntaxException
      extends GroovyException

  Base exception class indicating a syntax error detected during parsing. Captures source location information (line and column numbers) where the error occurred to facilitate debugging and error reporting.

- - ### Constructor Summary

    Constructors
    Constructor and description
    `SyntaxException(String message, ASTNode node)` Constructs a SyntaxException from an AST node's position information.
    `SyntaxException(String message, int startLine, int startColumn)` Constructs a SyntaxException with line and column information.
    `SyntaxException(String message, int startLine, int startColumn, int endLine, int endColumn)` Constructs a SyntaxException with complete position range information.
    `SyntaxException(String message, Throwable cause, int startLine, int startColumn)` Constructs a SyntaxException with a cause exception.
    `SyntaxException(String message, Throwable cause, int startLine, int startColumn, int endLine, int endColumn)` Constructs a SyntaxException with a cause exception and complete position information.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public int` | `getEndColumn()` Returns the ending column number of the error.
    `` | `public int` | `getEndLine()` Returns the ending line number of the error.
    `` | `public int` | `getLine()` Returns the starting line number of the error.
    `` | `public String` | `getMessage()` Returns the error message with location information appended.
    `` | `public String` | `getOriginalMessage()` Returns the original error message without location information.
    `` | `public String` | `getSourceLocator()` Returns the optional source locator string.
    `` | `public int` | `getStartColumn()` Returns the starting column number of the error.
    `` | `public int` | `getStartLine()` Returns the starting line number of the error.
    `` | `public void` | `setSourceLocator(String sourceLocator)` Sets an optional source locator string (e.g., file path, URL).

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class GroovyException` | `isFatal, setFatal`

- - ### Constructor Detail

    - #### public SyntaxException(String message, ASTNode node)

      Constructs a SyntaxException from an AST node's position information.

      Parameters:
        `message` - the error message
        `node` - the ASTNode where the error occurred

    - #### public SyntaxException(String message, int startLine, int startColumn)

      Constructs a SyntaxException with line and column information. The end position defaults to one column after the start position.

      Parameters:
        `message` - the error message
        `startLine` - the line number where the error starts (1-based)
        `startColumn` - the column number where the error starts (1-based)

    - #### public SyntaxException(String message, int startLine, int startColumn, int endLine, int endColumn)

      Constructs a SyntaxException with complete position range information.

      Parameters:
        `message` - the error message
        `startLine` - the line number where the error starts (1-based)
        `startColumn` - the column number where the error starts (1-based)
        `endLine` - the line number where the error ends (1-based)
        `endColumn` - the column number where the error ends (1-based)

    - #### public SyntaxException(String message, Throwable cause, int startLine, int startColumn)

      Constructs a SyntaxException with a cause exception. The end position defaults to one column after the start position.

      Parameters:
        `message` - the error message
        `cause` - the underlying Throwable that caused this exception
        `startLine` - the line number where the error starts (1-based)
        `startColumn` - the column number where the error starts (1-based)

    - #### public SyntaxException(String message, Throwable cause, int startLine, int startColumn, int endLine, int endColumn)

      Constructs a SyntaxException with a cause exception and complete position information.

      Parameters:
        `message` - the error message
        `cause` - the underlying Throwable that caused this exception
        `startLine` - the line number where the error starts (1-based)
        `startColumn` - the column number where the error starts (1-based)
        `endLine` - the line number where the error ends (1-based)
        `endColumn` - the column number where the error ends (1-based)

  - ### Method Detail

    - #### public int getEndColumn()

      Returns the ending column number of the error.

      Returns:
        the column number (1-based)

    - #### public int getEndLine()

      Returns the ending line number of the error.

      Returns:
        the line number (1-based)

    - #### public int getLine()

      Returns the starting line number of the error. Provided for backward compatibility; equivalent to getStartLine().

      Returns:
        the line number (1-based)

    - #### public String getMessage()

      Returns the error message with location information appended.

      Returns:
        the formatted message including line and column information

    - #### public String getOriginalMessage()

      Returns the original error message without location information.

      Returns:
        the base error message

    - #### public String getSourceLocator()

      Returns the optional source locator string.

      Returns:
        the source location identifier, or `null` if not set

    - #### public int getStartColumn()

      Returns the starting column number of the error.

      Returns:
        the column number (1-based)

    - #### public int getStartLine()

      Returns the starting line number of the error.

      Returns:
        the line number (1-based)

    - #### public void setSourceLocator(String sourceLocator)

      Sets an optional source locator string (e.g., file path, URL).

      Parameters:
        `sourceLocator` - the source location identifier