Package org.ek9lang.compiler.support.literals


package org.ek9lang.compiler.support.literals
THE reading of EK9 literals - one class per question, each held as an instance by the class that asks. Use these; never parse a literal's text with a private copy (F21: one literal was once read by four parsers that accepted different texts).

Values of a literal's text (the grammar admits forms the Java parse methods do not):

Literals in the parse tree:

  • Classes
    Class
    Description
    THE rewrite of a double-quoted String's text as a backtick String, delimiters included - use InterpolatingBacktickString or LiteralBacktickString, the two spellings it gives; never re-derive it.
    🔑 THE canonical text for reconstructing a literal through an org.ek9.lang _of(String) factory - the single place that turns a literal's raw source lexeme into text _of(String) can actually read.
    The value of a Character literal - quotes removed and escapes decoded (DecodedEscapes) - the text a Character constant is recorded with.
    THE value of an EK9 Character literal (quotes already stripped).
    THE reading of a Date literal (2024-01-15); throws DateTimeParseException.
    THE reading of a DateTime literal (2024-01-15T10:30:00Z); throws DateTimeParseException.
    THE decoding of the escape sequences in an EK9 String literal's text (quotes already stripped): \t, \n, A, \101, etc.
    THE value of an EK9 Float literal's text as a double - EK9 Float is 64-bit.
    An EK9 Float literal's text read as a Java float (underscore separators allowed, 1_000.5).
    Does the text between a double-quoted String's quotes hold ${? A double-quoted String is never interpolated, so the compiler rejects that (E07901) and names both backtick spellings (InterpolatingBacktickString, LiteralBacktickString).
    THE value of an EK9 Integer literal's text.
    The backtick String, delimiters included, in which every ${...} of a double-quoted String's text evaluates - what the writer almost always meant (E07901).
    Whether a symbol is a literal value that may be lifted into a module constant - the symbol-side companion to LiteralTypeNameOf (the parse-context side).
    True if this String literal is a plain double-quoted one - the only String form EK9 reads at compile time (PlainStringValue); a backtick String is not a compile-time literal (E07902).
    THE test for a unicode escape: a backslash, a 'u', then exactly four ASCII hex digits - the lexer's own UnicodeEscape.
    The backtick String, delimiters included, whose value keeps every ${ of a double-quoted String's text as characters.
    THE literal-context to fully-qualified-type-name resolver: the EK9 type a parsed literal denotes (e.g.
    The digits of the octal escape whose backslash is at the given offset: one to three octal digits, limited to \377 (255).
    THE value of a plain "..." String literal - the only String form EK9 reads at compile time: a constant, a constraint, a text's language, a service parameter's name.
    THE reading of a Time literal (07:30); throws DateTimeParseException.
    A numeric literal's text with its _ separators removed (1_000.5 reads as 1000.5).