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 = "}"
Нет стандартного вывода.Ожидаемый результат
Ожидаемый результат
Этап отклонения lex. Ненулевой код завершения.
diagnostic-tpz0005 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 = "\}"
Ожидаемый результат
Ожидаемый результат
Проверка принимает программу. Код завершения 0.
This program applies the repair described above. The verification status records whether it has been run.