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):
IntegerLiteralValue- hex, octal and_forms, 64-bit;DoubleLiteralValue(and the test-onlyFloatLiteralValue) -_forms;DateLiteralValue,TimeLiteralValue,DateTimeLiteralValue- the runtime's java.time choices.CharacterLiteralValue- a Character literal's escapes;DecodedEscapes- a String literal's escapes;IsUnicodeEscapeAt- THE unicode escape test both use (FE73).- 🔑
CanonicalTextForOf- THE text anorg.ek9.lang_of(String)factory can read back; every back end or evaluator that rebuilds a literal through_ofgoes through it.
Literals in the parse tree:
PlainStringValue- THE value of a plain"..."String (the only String form read at compile time), withIsPlainStringLiteralandCharacterLiteralText.LiteralTypeNameOfandIsExtractableLiteral- the type a literal denotes, from the 19 ofEk9LiteralTypes.LITERAL_TYPE_NAMES.HoldsInterpolation,InterpolatingBacktickStringandLiteralBacktickString- E07901's two backtick spellings of a double-quoted String holding${, shared by the message and the repair.
-
ClassesClassDescriptionTHE rewrite of a double-quoted String's text as a backtick String, delimiters included - use
InterpolatingBacktickStringorLiteralBacktickString, the two spellings it gives; never re-derive it.🔑 THE canonical text for reconstructing a literal through anorg.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); throwsDateTimeParseException.THE reading of a DateTime literal (2024-01-15T10:30:00Z); throwsDateTimeParseException.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 adouble- EK9Floatis 64-bit.An EK9 Float literal's text read as a Javafloat(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 toLiteralTypeNameOf(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 ownUnicodeEscape.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); throwsDateTimeParseException.A numeric literal's text with its_separators removed (1_000.5reads as1000.5).