Class ValidLiteralValueOrError

java.lang.Object
org.ek9lang.compiler.phase1.ValidLiteralValueOrError

final class ValidLiteralValueOrError extends Object
Validates literal values at compile time to catch semantically invalid literals that the ANTLR lexer accepts structurally but that can never represent valid values. For example, 2024-13-45 matches the DateLiteral lexer rule but month 13 and day 45 are invalid. At runtime, invalid literals silently become "unset" (by design for user input), but for source code literals this is always a bug.
  • Constructor Details

    • ValidLiteralValueOrError

      ValidLiteralValueOrError(ErrorListener errorListener)
  • Method Details

    • isValid

      boolean isValid(org.antlr.v4.runtime.Token start, String typeName, String literalText)
      Check if the literal text is a valid value for the given type.
      Returns:
      true if valid (or if no validation applies), false if invalid (error already emitted).