Tue Jun 2 17:45:55 CEST 2009
Ulf Wiger <ulf.wiger@REDACTED> writes:
> mats cronqvist wrote:
>> Ulf Wiger <ulf.wiger@REDACTED> writes:
>>> This *will* compile:
>>> f() ->
>>> Changing the meaning of r"\b", it will no longer compile.
>> but... the -r is handled by the preprocessor, not? so the parser
>> will never see the -r"\b" bit, and it will still compile.
> No, the preprocessor (epp) gets the 'attribute' form from the
> parser, and only deals with certain attributes. The compiler
> deals with some others, and external tools (like dialyzer)
> can also rely on attributes.
> They are part of the grammar.
> attribute -> '-' atom attr_val : build_attribute('$2', '$3').
> attr_val -> expr : ['$1'].
> attr_val -> expr ',' exprs : ['$1' | '$3'].
> attr_val -> '(' expr ',' exprs ')' : ['$2' | '$4'].
> (From erl_parse.yrl)
but still. couldn't the grammar can be extended to compile this;
without changing the meaning of this;
by adding something like
raw_string -> 'r' raw_string : build_raw_string('$2')
to the grammar?
I obviously have no idea what I'm talking about here...
More information about the erlang-questions