Skip to content
Topaz6.0 · Before release
Download

Search documentation

Specification 6.0 · Not released · Tested product 5.21.3

Use arrow keys to choose a result. Press Enter to open.

Type an API name, diagnostic number, rule, or project topic.

    Diagnostics

    TPZ0004: Invalid escape sequence

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

    Diagnostic and cause

    Link

    Invalid escape sequence

    Family
    topaz
    Phase
    lex
    Code
    TPZ0004

    Cause and conditions

    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.

    Source evidence

    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.

    Rulediagnostics.tpz0004.rule

    Trigger and repair

    A backslash in string text must introduce a supported escape. The escape \q produces TPZ0004 at the backslash.

    Source evidence

    Response

    Link

    Use the intended supported escape, or escape the backslash itself when it belongs in the string.

    Reproduction and verification

    Link

    Rejected program

    Link
    example.tpzRejected programOpen in Playground
    1. let message = "\q"
    Expected outputNonzero exit
    No stdout.
    $ topaz check example.tpz · target product 5.21.3
    Expected result

    Expected result

    Rejection during lex. Nonzero exit.

    • TPZ0004 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.

    Source evidence

    Corrected program

    Link
    example.tpzCorrected program
    1. let message = "\\q"
    Expected outputexit 0
    $ topaz check example.tpz · target product 5.21.3
    Expected result

    Expected result

    Checking accepts the program. Exit code 0.

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

    Source evidence

    Menu

    Download