Class UnicodeEscapeOrError
java.lang.Object
org.ek9lang.compiler.phase1.UnicodeEscapeOrError
- All Implemented Interfaces:
Consumer<EK9Parser.StringLitContext>
A backslash-u in a String literal must be followed by exactly four hex digits (E07903). The lexer only ever took
backslash-u plus four ASCII hex digits as an escape, but the decoder re-read the text with
parseInt(hex, 16),
which also takes a sign and any Unicode digit: backslash-u "+041" became 'A' and backslash-u "-001" U+FFFF
(front-end audit FE73). Steve: a new code, so a malformed escape is named for what it is. Checked in a double-quoted
String and in the text of a backtick String; not in a directive's String, which is test metadata.
The same walk reports a surrogate escape (D800-DFFF) that is not a high one directly followed by a low one (E07904, Steve 2026-11-04): a String or Character is a sequence of Unicode code points, and half of a code point above U+FFFF is not one. A pair of escapes in a String is one character; in a Character literal a surrogate escape is always alone, so always an error.
(No backslash-u appears literally in this comment: javac decodes unicode escapes even in comments.)
-
Constructor Details
-
UnicodeEscapeOrError
UnicodeEscapeOrError(ErrorListener errorListener)
-
-
Method Details
-
acceptCharacterLiteral
Check a Character literal's escape. -
accept
- Specified by:
acceptin interfaceConsumer<EK9Parser.StringLitContext>
-