Escapes within quoted atoms
Richard A. O'Keefe
Thu Jan 12 05:01:00 CET 2006
Roger Price <rprice@REDACTED> wrote:
\^A .. \^Z The given meaning is "control A to control Z (i.e. 0..26)"
That should be *ONE* to twenty-six.
NUL (16'00) is ^@ (control-at-sign)
SOH (16'01) is ^A (control-A)
SUB (16'1a) is ^Z (control-Z)
It is implicit in chapter 2.1.2 that \x => x if x has no other meaning, so
why don't I see '\^Ã' => '^Ã'.
That refers to a single-character x, and \^ *does* have another meaning,
so one would not expect \^ ever to pass through unaltered.
(One would also not expect it not to pass through unaltered when
followed by something that doesn't make sense.)
Several other programming languages support something like \^
and the expectation is that you can get *all* of the C0 controls
that way, plus DEL, which is traditionally \^?. One excessively
trusting tokeniser I happen to have lying around does this:
case '^': /* control */
c = getc(card);
if (c < 0) goto ERROR;
return c == '?' ? 127 : c&31;
More information about the erlang-questions