Class BadSyntax

All Implemented Interfaces:
Serializable

public class BadSyntax extends RuntimeException
Runtime exception for reporting syntax errors in the Turi language with detailed positional information. Provides context about where the syntax error occurred, including file location and surrounding code.
See Also:
  • Constructor Details

    • BadSyntax

      public BadSyntax(ch.turic.analyzer.Pos position, String s, Object... params)
      Constructs a new BadSyntax exception with detailed error information.
      Parameters:
      position - The position where the syntax error occurred
      s - The error message format string
      params - The parameters to be formatted into the message
  • Method Details

    • when

      public static void when(ch.turic.analyzer.LexList lexes, boolean b, String msg, Object... parameters) throws BadSyntax
      Throws a BadSyntax exception when the given condition is true using lexer position information.
      Parameters:
      lexes - The lexer containing position information
      b - The condition that triggers the exception when true
      msg - The error message format string
      parameters - The parameters to be formatted into the message
      Throws:
      BadSyntax - when the condition is true
    • when

      public static void when(ch.turic.analyzer.Pos position, boolean b, String msg, Object... parameters) throws BadSyntax
      Throws a BadSyntax exception when the given condition is true using explicit position information.
      Parameters:
      position - The position information for the error
      b - The condition that triggers the exception when true
      msg - The error message format string
      parameters - The parameters to be formatted into the message
      Throws:
      BadSyntax - when the condition is true
    • when

      public static void when(ch.turic.analyzer.Pos position, boolean b, Supplier<String> msg) throws BadSyntax
      Throws a BadSyntax exception when the given condition is true using a message supplier.
      Parameters:
      position - The position information for the error
      b - The condition that triggers the exception when true
      msg - A supplier that provides the error message
      Throws:
      BadSyntax - when the condition is true