Re: Semantic parses function with default argument incorrectly
Bastian Beischer <[email protected]> Fri, 2 Sep 2016 15:47:12 +0200
| Newsgroups | gmane.emacs.semantic |
|---|---|
| Message-ID | <CAK9AuB8kHNeEbLhGWTE=MmTHx7MU6hDASPkYzG1JDz44espDUA@mail.gmail.com> |
--===============6618259530051799849== Content-Type: multipart/alternative; boundary=047d7bacc0fe5e3882053b8691da --047d7bacc0fe5e3882053b8691da Content-Type: text/plain; charset=UTF-8 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 >>> >> >> >> >> --047d7bacc0fe5e3882053b8691da Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <p dir=3D"ltr">Hi Eric, </p> <p dir=3D"ltr">I found this issue because semantic-analyze-proto-impl-toggl= e was unable to jump between declaration (which had the default value assig= nment) 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> Bastian </p> <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">[email protected]</a>>:<br type=3D"attribution"><blockquote cla= ss=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pa= dding-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> --047d7bacc0fe5e3882053b8691da-- --===============6618259530051799849== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ --===============6618259530051799849== 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 --===============6618259530051799849==--