Diagnostic and cause
링크Stray brace in string
- 계열
- topaz
- 단계
- lex
- 코드
TPZ0005
원인과 조건
A literal closing brace in single-line string text must be escaped as \}. An unescaped brace produces TPZ0005.
관련 규칙 · Trigger and repair →대응
Escape a literal closing brace. When interpolation was intended, supply the opening brace and expression.
Compiler phase: lex.
Compiler explanation: A template/text string contains a brace that is not a valid interpolation boundary.
Message templates. The marker ⟨value⟩ stands for text computed for the reported program.
- unescaped
}in a string literal; write\}Source
Observed for the candidate in Topaz 5.21.3. Execution
- error[TPZ0005]: unescaped
}in a string literal; write\}
A closing brace appears unescaped in single-line string text. It is not closing a currently parsed interpolation.
Trigger and repair
A literal closing brace in single-line string text must be escaped as \}. An unescaped brace produces TPZ0005.
Response
링크Escape a literal closing brace. When interpolation was intended, supply the opening brace and expression.
Reproduction and verification
링크Rejected program
링크let message = "}"
표준 출력 없음.기대 결과
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 = "\}"
기대 결과
기대 결과
검사가 프로그램을 받아들입니다. 종료 코드 0.
This program applies the repair described above. The verification status records whether it has been run.