Перейти к содержимому
Топаз6.0 · До релиза
Загрузка →

Поиск в документации

Спецификация 6.0

Выберите результат стрелками и нажмите Enter, чтобы открыть его.

Введите имя API, номер диагностики, правило или тему проекта.

    Диагностика TPZ0004

    A string or template literal contains an escape sequence Topaz does not define.

    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.

    Действия

    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 \q in 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.

    Правилоdiagnostics.tpz0004.rule

    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

    Ссылка
    example.tpzRejected programОткрыть песочницу →
    1. let message = "\q"
    Ожидаемый выводНенулевой код завершения
    Нет стандартного вывода.
    $ topaz check example.tpz · Целевой продукт 5.21.3
    Ожидаемый результат

    Ожидаемый результат

    Этап отклонения lex. Ненулевой код завершения.

    The expected diagnostic, cause, source location, and accompanying diagnostics are specified below. The verification status records whether this program has been run.

    Corrected program

    Ссылка
    example.tpzCorrected program
    1. let message = "\\q"
    Ожидаемый выводКод завершения 0
    $ topaz check example.tpz · Целевой продукт 5.21.3
    Ожидаемый результат

    Ожидаемый результат

    Проверка принимает программу. Код завершения 0.

    This program applies the repair described above. The verification status records whether it has been run.

    Меню

    Загрузка →