Class IntegerLiteralRange

java.lang.Object
dev.frostlake.executor.IntegerLiteralRange

public final class IntegerLiteralRange extends Object
How wide a WRITTEN integer literal may be. The largest exact numeric is NUMBER(38,0), so 38 significant digits is the most one can carry: 39 is refused by the literal READER, before any clause sees the number, and the refusal is positioned at the literal's own offset.

Three rules that had to be measured rather than assumed:

  • Only a POINT-FREE, EXPONENT-FREE literal belongs to this family. The same magnitude written with a decimal point or an exponent is a DOUBLE, which has no such limit — 999…9.0 (39 nines) and 1e39 both answer. That is why the sentence says INTEGER literal.
  • The limit counts SIGNIFICANT digits, so leading zeros are free: 39 zeros is a legal way to write 0, and 40 zeros followed by a 1 is a legal way to write 1. But the ECHO is the literal exactly as written, leading zeros included.
  • A leading minus is NOT part of the literal — it is a unary operator. The position is the DIGITS' own offset (one past the sign) and the echoed value carries no sign.
  • Method Details

    • isOutOfRange

      public static boolean isOutOfRange(String digits)
      Whether this run of digits is too wide to be read as an integer literal.
    • sentence

      public static String sentence(String digits)
      The refusal's own sentence, echoing the literal as it was written.
    • reject

      public static void reject(org.antlr.v4.runtime.Token token)
      Refuse the token if its digits are too wide. For the readers that take a literal straight from the token stream — the LIMIT / OFFSET slots and a column DEFAULT — where the token's position is already statement-relative and needs no fragment resolution.