Adoption of perl/javascript-style regexp syntax

Ulf Wiger ulf.wiger@REDACTED
Tue Jun 2 19:14:25 CEST 2009


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.

BR,
Ulf W
-- 
Ulf Wiger
CTO, Erlang Training & Consulting Ltd
http://www.erlang-consulting.com


More information about the erlang-questions mailing list