Re: Semantic parses function with default argument incorrectly
Bastian Beischer <[email protected]> Tue, 13 Sep 2016 10:24:10 +0200
| Newsgroups | gmane.emacs.semantic |
|---|---|
| Message-ID | <CAK9AuB92WBFYSFXrpun7OOQWWY7Txg_9uHWG1RPZxTz=NU1avg@mail.gmail.com> |
--===============5173972048229432978== Content-Type: multipart/alternative; boundary=047d7ba97df84ed8bc053c5f56eb --047d7ba97df84ed8bc053c5f56eb Content-Type: text/plain; charset=UTF-8 Hello Eric, would it be acceptable to commit my patch to the CEDET repository? If yes, could you please do it? :-) I don't have commit access. Cheers Bastian On Fri, Sep 2, 2016 at 3:47 PM, Bastian Beischer < [email protected]> wrote: > Hi Eric, > > I found this issue because semantic-analyze-proto-impl-toggle was unable > to jump between declaration (which had the default value assignment) and > implementation (which didn't). > > I don't know if this makes a good test. > > Cheers > Bastian > > Am 01.09.2016 03:22 schrieb "Eric Ludlam" <[email protected]>: > >> Hi, >> >> I've experimented with your patch, and agree that this looks like the >> right solution to me. >> >> I also added a test that this will both parse, and then the tag will >> format itself correctly. >> >> Were there any completion related examples you might have I could add for >> additional test coverage? >> >> Thanks >> Eric >> >> On 08/30/2016 06:11 PM, Bastian Beischer wrote: >> >>> I think I may have found the solution, but it would be great if >>> someone could check this patch: >>> >>> diff --git a/lisp/cedet/semantic/bovine/c.by >>> b/lisp/cedet/semantic/bovine/c.by >>> index 80ed2cf..6c4cea4 100644 >>> --- a/lisp/cedet/semantic/bovine/c.by >>> +++ b/lisp/cedet/semantic/bovine/c.by >>> @@ -1250,7 +1250,7 @@ unaryexpression >>> | multi-stage-dereference >>> | NEW multi-stage-dereference >>> | NEW builtintype-types semantic-list >>> - | symbol >>> + | namespace-symbol >>> ;; Klaus Berndl: C/C++ allows sequences of strings which are >>> ;; concatenated by the precompiler to one string >>> | string-seq >>> >>> On Tue, Aug 30, 2016 at 11:40 PM, Bastian Beischer >>> <[email protected]> wrote: >>> >>>> The following piece of code is not correctly parsed by semantic: >>>> >>>> namespace NS { >>>> enum TestEnum {a,b}; >>>> } >>>> >>>> void f(NS::TestEnum v = NS::a); >>>> >>>> This is with the current master branch of >>>> http://git.code.sf.net/p/cedet/git. >>>> >>>> The issue is that after parsing the buffer 'semantic-describe-tag' on >>>> the function 'f' reports: >>>> >>>> Functions: void f (NS::TestEnum v[=NS],a) >>>> >>>> "a" is interpreted as a second argument which is not correct. The >>>> version of semantic included in Emacs 25.1 RC 2 does not show this >>>> behavior. Instead it reports: >>>> >>>> Functions: void f (NS::TestEnum v[=NS]) >>>> >>>> which is also not correct, it should report the default value as NS::a. >>>> >>>> I think the grammar needs tweaking? Any help on how to fix this? >>>> >>>> Cheers >>>> Bastian >>>> >>>> -- >>>> Bastian Beischer >>>> RWTH Aachen University of Technology >>>> >>>> @RWTH Aachen >>>> Office: 28 C 203 >>>> Phone: +49-241-80-27205 >>>> E-mail: [email protected] >>>> Address: I. Physikalisches Institut B, Sommerfeldstr. 14, D-52074 Aachen >>>> >>>> @CERN >>>> Office: Bdg 32-4-B12 >>>> Phone: +41-22-76-75750 >>>> E-mail: [email protected] >>>> Address: CERN, CH-1211 Geneve 23 >>>> >>> >>> >>> >>> -- Bastian Beischer RWTH Aachen University of Technology @RWTH Aachen Office: 28 C 203 Phone: +49-241-80-27205 E-mail: [email protected] Address: I. Physikalisches Institut B, Sommerfeldstr. 14, D-52074 Aachen @CERN Office: Bdg 32-4-B12 Phone: +41-22-76-75750 E-mail: [email protected] Address: CERN, CH-1211 Geneve 23 --047d7ba97df84ed8bc053c5f56eb Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:arial,he= lvetica,sans-serif">Hello Eric,</div><div class=3D"gmail_default" style=3D"= font-family:arial,helvetica,sans-serif"><br></div><div class=3D"gmail_defau= lt" style=3D"font-family:arial,helvetica,sans-serif">would it be acceptable= to commit my patch to the CEDET repository? If yes, could you please do it= ? :-) I don't have commit access.</div><div class=3D"gmail_default" sty= le=3D"font-family:arial,helvetica,sans-serif"><br></div><div class=3D"gmail= _default" style=3D"font-family:arial,helvetica,sans-serif">Cheers</div><div= class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-serif">B= astian</div></div><div class=3D"gmail_extra"><br><div class=3D"gmail_quote"= >On Fri, Sep 2, 2016 at 3:47 PM, Bastian Beischer <span dir=3D"ltr"><<a = href=3D"mailto:[email protected]" target=3D"_blank">bastian.b= [email protected]</a>></span> wrote:<br><blockquote class=3D"gmail_= quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1= ex"><p dir=3D"ltr">Hi Eric, </p> <p dir=3D"ltr">I found this issue because semantic-analyze-proto-impl-<wbr>= toggle was unable to jump between declaration (which had the default value = assignment) and implementation (which didn't). </p> <p dir=3D"ltr">I don't know if this makes a good test. </p> <p dir=3D"ltr">Cheers <br><span class=3D"HOEnZb"><font color=3D"#888888"> Bastian </font></span></p><div class=3D"HOEnZb"><div class=3D"h5"> <div class=3D"gmail_extra"><br><div class=3D"gmail_quote">Am 01.09.2016 03:= 22 schrieb "Eric Ludlam" <<a href=3D"mailto:eric@siege-engine.= com" target=3D"_blank">[email protected]</a>>:<br type=3D"attributio= n"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left= :1px #ccc solid;padding-left:1ex">Hi,<br> <br> I've experimented with your patch, and agree that this looks like the r= ight solution to me.<br> <br> I also added a test that this will both parse, and then the tag will format= itself correctly.<br> <br> Were there any completion related examples you might have I could add for a= dditional test coverage?<br> <br> Thanks<br> Eric<br> <br> On 08/30/2016 06:11 PM, Bastian Beischer wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> I think I may have found the solution, but it would be great if<br> someone could check this patch:<br> <br> diff --git a/lisp/cedet/semantic/bovine/<a href=3D"http://c.by" rel=3D"nore= ferrer" target=3D"_blank">c<wbr>.by</a> b/lisp/cedet/semantic/bovine/<a hre= f=3D"http://c.by" rel=3D"noreferrer" target=3D"_blank">c<wbr>.by</a><br> index 80ed2cf..6c4cea4 100644<br> --- a/lisp/cedet/semantic/bovine/<a href=3D"http://c.by" rel=3D"noreferrer"= target=3D"_blank">c<wbr>.by</a><br> +++ b/lisp/cedet/semantic/bovine/<a href=3D"http://c.by" rel=3D"noreferrer"= target=3D"_blank">c<wbr>.by</a><br> @@ -1250,7 +1250,7 @@ unaryexpression<br> =C2=A0 =C2=A0| multi-stage-dereference<br> =C2=A0 =C2=A0| NEW multi-stage-dereference<br> =C2=A0 =C2=A0| NEW builtintype-types semantic-list<br> -=C2=A0 | symbol<br> +=C2=A0 | namespace-symbol<br> =C2=A0 ;; Klaus Berndl: C/C++ allows sequences of strings which are<br> =C2=A0 ;; concatenated by the precompiler to one string<br> =C2=A0 =C2=A0| string-seq<br> <br> On Tue, Aug 30, 2016 at 11:40 PM, Bastian Beischer<br> <<a href=3D"mailto:[email protected]" target=3D"_blank">ba= stian.beischer@rwth-aachen.<wbr>de</a>> wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> The following piece of code is not correctly parsed by semantic:<br> <br> namespace NS {<br> =C2=A0enum TestEnum {a,b};<br> }<br> <br> void f(NS::TestEnum v =3D NS::a);<br> <br> This is with the current master branch of <a href=3D"http://git.code.sf.net= /p/cedet/git" rel=3D"noreferrer" target=3D"_blank">http://git.code.sf.net/p= /cedet<wbr>/git</a>.<br> <br> The issue is that after parsing the buffer 'semantic-describe-tag' = on<br> the function 'f' reports:<br> <br> Functions: void f (NS::TestEnum v[=3DNS],a)<br> <br> "a" is interpreted as a second argument which is not correct. The= <br> version of semantic included in Emacs 25.1 RC 2 does not show this<br> behavior. Instead it reports:<br> <br> Functions: void f (NS::TestEnum v[=3DNS])<br> <br> which is also not correct, it should report the default value as NS::a.<br> <br> I think the grammar needs tweaking? Any help on how to fix this?<br> <br> Cheers<br> Bastian<br> <br> --<br> Bastian Beischer<br> RWTH Aachen University of Technology<br> <br> @RWTH Aachen<br> Office: 28 C 203<br> Phone: <a href=3D"tel:%2B49-241-80-27205" value=3D"+492418027205" target=3D= "_blank">+49-241-80-27205</a><br> E-mail: <a href=3D"mailto:[email protected]" target=3D"_blank"= >[email protected]</a><br> Address: I. Physikalisches Institut B, Sommerfeldstr. 14, D-52074 Aachen<br= > <br> @CERN<br> Office: Bdg 32-4-B12<br> Phone: <a href=3D"tel:%2B41-22-76-75750" value=3D"+41227675750" target=3D"_= blank">+41-22-76-75750</a><br> E-mail: <a href=3D"mailto:[email protected]" target=3D"_blank">basti= [email protected]</a><br> Address: CERN, CH-1211 Geneve 23<br> </blockquote> <br> <br> <br> </blockquote> </blockquote></div></div> </div></div></blockquote></div><br><br clear=3D"all"><div><br></div>-- <br>= <div class=3D"gmail_signature" data-smartmail=3D"gmail_signature">Bastian B= eischer<br>RWTH Aachen University of Technology<br><br>@RWTH Aachen<br>Offi= ce: 28 C 203<br>Phone: +49-241-80-27205<br>E-mail: <a href=3D"mailto:beisch= [email protected]" target=3D"_blank">[email protected]<= /a><br>Address: I. Physikalisches Institut B, Sommerfeldstr. 14, D-52074 Aa= chen<br><br>@CERN<br>Office: Bdg 32-4-B12<br>Phone: +41-22-76-75750<br>E-ma= il: <a href=3D"mailto:[email protected]" target=3D"_blank">bastian.b= [email protected]</a><br>Address: CERN, CH-1211 Geneve 23</div> </div> --047d7ba97df84ed8bc053c5f56eb-- --===============5173972048229432978== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ --===============5173972048229432978== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ cedet-semantic mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cedet-semantic --===============5173972048229432978==--