Diagnostic and cause
СсылкаInvalid escape sequence
- Семейство
- topaz
- Этап
- lex
- Код
TPZ0004
Причина и условия
A backslash in string text must introduce a supported escape. The escape \q produces TPZ0004 at the backslash.
Связанное правило · Trigger and repair →Действия
Use the intended supported escape, or escape the backslash itself when it belongs in the string.
Compiler phase: lex.
Compiler explanation: A string or template literal contains an escape sequence Topaz does not define.
Message templates. The marker ⟨value⟩ stands for text computed for the reported program.
- invalid escape:
\before the end of the line Source - invalid escape
\⟨value⟩in a string literal Source
Observed for the candidate in Topaz 5.21.3. Execution
- error[TPZ0004]: invalid escape
\qin a string literal
The character following a backslash does not form a supported escape. A backslash at the end of a line also needs attention.
Trigger and repair
A backslash in string text must introduce a supported escape. The escape \q produces TPZ0004 at the backslash.
Response
СсылкаUse the intended supported escape, or escape the backslash itself when it belongs in the string.
Reproduction and verification
СсылкаRejected program
Ссылкаlet message = "\q"
Нет стандартного вывода.Ожидаемый результат
Ожидаемый результат
Этап отклонения lex. Ненулевой код завершения.
diagnostic-tpz0004 at
example.tpz:1:16
The expected diagnostic, cause, source location, and accompanying diagnostics are specified below. The verification status records whether this program has been run.
Corrected program
Ссылкаlet message = "\\q"
Ожидаемый результат
Ожидаемый результат
Проверка принимает программу. Код завершения 0.
This program applies the repair described above. The verification status records whether it has been run.