Skip to content
Playground(another site)

bynk.lex.bad_escape

Error An invalid escape sequence in a string literal.

A backslash in a string literal starts an escape, and this one is not in the set: \n, \r, \t, \0, \", \\, \u{…} (1 to 6 hex digits in braces) and \(…) for interpolation. To write a backslash itself, double it, as in a Windows path. A \u{…} naming a surrogate or a value past U+10FFFF is bynk.lex.bad_unicode_escape.

Example

const Dir: String = "C:\Users" // ✗ `\U` is not an escape
const Dir: String = "C:\\Users" // ✓ a doubled backslash

In the Book

See also

  • The grammar rule it governs: string_literal.
  • Every code in its category, Lexer, on the diagnostic index.
  • bynk explain bynk.lex.bad_escape shows the same from the installed toolchain, without a network.