Adoption of perl/javascript-style regexp syntax

mats cronqvist masse@REDACTED
Wed Jun 3 08:47:37 CEST 2009


Ulf Wiger <ulf.wiger@REDACTED> writes:

> mats cronqvist wrote:
>> Ulf Wiger <ulf.wiger@REDACTED> writes:
>>
>>   but still. couldn't the grammar can be extended to compile this;
>>
>> -module(m).
>>
>> -r"bla".
>>
>> foo() ->
>>   r"foo".
>>
>>
>>   without changing the meaning of this;
>>
>> -module(m).
>>
>> -r"bla".
>>
>> foo() ->
>>   "foo".
>
> No, the attribute would still not compile, since
> it would convert to a "raw string", which is not a
> legal attribute (and certainly not the attribute that it
> was before.)
>
>>   by adding something like 
>>
>> raw_string -> 'r' raw_string      : build_raw_string('$2')
>>
>>   to the grammar?
>
> The problem with that is that we'd have to make
> 'r' a reserved word (a terminal) - otherwise, it will be
> a dirty hack to the parser. This will mean that all
> instances of the atom r in existing source code would
> have to be quoted.

  Well, "dirty hack" or not, it is doable. And on the grand scale of
  suckiness it's still better than allowing the -r"bla" madness.

  mats


More information about the erlang-questions mailing list