String escapes

From Erights

(Difference between revisions)
Jump to: navigation, search

Latest revision as of 13:29, 26 October 2010

E uses C-style backslash escapes within string and character literals. The defined escapes are:

Sequence Unicode Meaning
\b U+0008 (Backspace)
\t U+0009 (Tab)
\n U+000A (Line feed)
\f U+000C (Form feed)
\r U+000D (Carriage return)
\" U+0022 "
\' U+0027 '
\\ U+005C \
\\ U+002f / (Defined in the BaseLexer for TermL JSON compatibility -- perhaps should not be in the E syntax, but no harm in it)
\<newline> None (Line continuation -- stands for no characters)
\uXXXX U+XXXX (BMP Unicode character, 4 hex digits)

Consensus has not been reached on handling non-BMP characters. All other backslash-followed-by-character sequences are syntax errors.

Within E quasiliterals, backslash is not special and $\ plays the same role;

? println(`1 + 1$\n= ${1 + 1}`)
1 + 1
= 2
Personal tools
more tools