Adoption of perl/javascript-style regexp syntax

mats cronqvist masse@REDACTED
Tue Jun 2 15:50:49 CEST 2009

Ulf Wiger <ulf.wiger@REDACTED> writes:

> Geoffrey Biggs wrote:
>> Python provides a method of specifying strings they call "raw
>> strings," which I find quite interesting. Basically, you prefix your
>> string with r or R, and any backslashes are treated as literal
>> characters rather than escape sequences. For example:
>>  >>> '\b'
>> '\x08'
>>  >>> r'\b'
>> '\\b'
> The problem is that this uses regular tokens and has a valid
> parse scan result today:
> 4> erl_scan:string("r'\b'.").
> {ok,[{atom,1,r},{atom,1,'\b'},{dot,1}],1}


  first off, it should be r"\b".

  second, it will scan, but not parse...

1> {ok,Ts,_} = erl_scan:string("r\"\b\".").

2> erl_parse:parse(Ts).
{error,{1,erl_parse,["syntax error before: ","\"\\b\""]}}

  or do I misunderstand you?



More information about the erlang-questions mailing list