[erlang-questions] some lexical questions

Andrew Thompson <>
Mon Jul 12 17:09:47 CEST 2010


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.

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.
> 
> 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


More information about the erlang-questions mailing list