On Wed, Oct 22, 2008 at 8:32 AM, Kenneth Lundin <span dir="ltr"><<a href="mailto:kenneth.lundin@gmail.com">kenneth.lundin@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Thanks for the reference implementation but we already have this implemented.<br>
We will look at your implementation and see if it adds something to<br>
the one we already have.<br>
</blockquote><div><br>My implementation makes sure that Name/Arity is allowed is allowed only in attributes and<br>nowhere else.<br><br>/Bjorn<br><br>*** erl_parse.yrl@@/OTP_R12B-4 2008-06-10 14:47:26.000000000 +0200<br>
--- erl_parse.yrl@@/main/release/r12b_patch/r12b_otp_7586/1 2008-10-08 16:06:09.000000000 +0200<br>***************<br>*** 704,710 ****<br> end;<br> build_attribute({atom,La,Attr}, Val) -><br> case Val of<br>
! [Expr] -><br> {attribute,La,Attr,term(Expr)};<br> _Other -> return_error(La, "bad attribute")<br> end.<br>--- 705,712 ----<br> end;<br> build_attribute({atom,La,Attr}, Val) -><br>
case Val of<br>! [Expr0] -><br>! Expr = attribute_farity(Expr0),<br> {attribute,La,Attr,term(Expr)};<br> _Other -> return_error(La, "bad attribute")<br> end.<br>***************<br>
*** 715,720 ****<br>--- 717,734 ----<br> var_list(Other) -><br> return_error(?line(Other), "bad variable list").<br> <br>+ attribute_farity({cons,L,H,T}) -><br>+ {cons,L,attribute_farity(H),attribute_farity(T)};<br>
+ attribute_farity({tuple,L,Args0}) -><br>+ Args = attribute_farity_list(Args0),<br>+ {tuple,L,Args};<br>+ attribute_farity({op,L,'/',{atom,_,_}=Name,{integer,_,_}=Arity}) -><br>+ {tuple,L,[Name,Arity]};<br>
+ attribute_farity(Other) -> Other.<br>+ <br>+ attribute_farity_list(Args) -><br>+ [attribute_farity(A) || A <- Args].<br>+ <br> -spec(error_bad_decl/2 :: (integer(), attributes()) -> no_return()).<br>
<br> error_bad_decl(L, S) -><br><br></div></div><br>-- <br>Björn Gustavsson, Erlang/OTP, Ericsson AB<br>