[erlang-questions] some lexical questions

Joe Armstrong <>
Tue Jul 13 09:07:20 CEST 2010

On Mon, Jul 12, 2010 at 5:09 PM, Andrew Thompson <> wrote:
> On Mon, Jul 12, 2010 at 04:10:56PM +0200, Joe Armstrong wrote:
>> Hello,
>> 1) Is there a "definitive" reference for the meaning of the
>> allowed escape sequences within a string?
>> The best I've found is in the on-line documentation in section 2.14
>> of http://www.erlang.org/doc/reference_manual/data_types.html
>> But the shell seems to parse "\^[" as [27] - now either table 2.14 is
>> incorrect or the implementation is incorrect since following \^ there
>> should be only be a character matching [a-zA-Z].
> \^[ is a synonym for \e (ctrl-escape). Apparently if you input a string
> with "\^[" in it in the shell (R14A) the returned value is "\e", I know
> the terminal code won't let you pass a raw \e to the underlying
> terminal.
> I'm guessing the table listing is just incomplete.

or the implementation is incorrect. All I know is that the documentation
says one thing, the implementation does something different.

> Escaping \a and having it treated as \a is the same behaviour seen in
> regular expressions, basically if the unescaped value isn't special, it
> unescapes it.

I know - in fact the quoting conventions seem rather strange. The intention
was to provide a mechanism to allow any character code to be inserted into a
string (which is also a list). The problem is the \O.. and \x... conventions
\x has two forms \xHHH and \x{HHH} the curly brackets are useful when
the character immediately following HHH could be interpreted as a hex digit.
There is no such convention for octal digits, which become a pain if,
for example,
the character following a two digit octal number might build a valid three digit
octal number. It would be nice to write \o{12}3... and not \012\003...
to create the
list [8#12,3,...]

>> Also \X where X is non of the alternatives in table 2.14 defaults to
>> X - but it should be an error by table 2.14 since X is none of the defined
>> alternatives. The shell thinks "\a" is the same as "a" but I think this
>> is confusing, in any case its an undocumened feature.
>> 2) There is a strange character in line 1678 of asn1ct.erl
>>    Emacs thinks this character is #xA0 encoded with iso-latin-1-unix
> I can't even find this character in my copy of this file. Maybe the line
> number is different with my copy (R14A).
> Andrew
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:

More information about the erlang-questions mailing list