Class BadSyntax
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
ch.turic.BadSyntax
- All Implemented Interfaces:
Serializable
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidThrows a BadSyntax exception when the given condition is true using lexer position information.static voidThrows a BadSyntax exception when the given condition is true using explicit position information.static voidThrows a BadSyntax exception when the given condition is true using a message supplier.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
BadSyntax
Constructs a new BadSyntax exception with detailed error information.- Parameters:
position- The position where the syntax error occurreds- The error message format stringparams- 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 informationb- The condition that triggers the exception when truemsg- The error message format stringparameters- 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 errorb- The condition that triggers the exception when truemsg- The error message format stringparameters- 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 errorb- The condition that triggers the exception when truemsg- A supplier that provides the error message- Throws:
BadSyntax- when the condition is true
-