Class BinaryLiteralText

java.lang.Object
dev.frostlake.executor.expressions.BinaryLiteralText

public final class BinaryLiteralText extends Object
A hex BINARY literal's text, X'..', read the way live reads it: SPACES inside the quotes are dropped wherever they fall (X'00 11' is two bytes, X'0 0' one), and what remains must be pairs of hexadecimal digits. Anything else — an odd count, a letter past F, a tab — is refused while the statement compiles, echoing the literal as written: Invalid binary literal x'0'; should contain pairs of hexadecimal digits. (all live-verified).
  • Method Details

    • decode

      public static BinaryValue decode(String token)
      The bytes a literal token spells.
      Parameters:
      token - the token as written, X and quotes included
      Returns:
      its value
    • declaredWidth

      public static int declaredWidth(BinaryValue value)
      The width a literal declares: its byte count, and one for the empty X'' (live types it BINARY(1), as it does every literal of one byte).
      Parameters:
      value - the literal's value
      Returns:
      the declared width