Skip to Content
i documentation
The language standardChapters

Appendix C. String grammar

The string additions to the surface grammar are summarized here (the full lexical rules are §1.6 and pattern rules are §7.1):

StringExpr = cooked_string | multiline_string | raw_string .
StringInterpolation = "\(" Expr ")" .
StringPattern = string_lit "<>" Binder [ "<>" string_lit ]
              | Binder "<>" string_lit .

raw_string requires equal opening and closing hash counts and enables escapes/interpolation only with that same count after the backslash. string_lit in a pattern or another literal-only position excludes interpolation. Multi-line delimiters and indentation have the line constraints of §1.6.