[CEDET-devel] Re[1]: Another semantic parsing issue.
Brought to you by:
zappo
From: Eric M. L. <er...@si...> - 2004-07-13 21:44:45
|
Hi, Could you please turn of HTML when you send email. I cannot copy/paste the source you have sent because it is full of html syntax. The problem, is because semantic does not know the value of the THIS_IS_UGLY macro. Solving the problem requires both writing a pre-processor stage into Semantic, and forcing semantic to parse all header files in order to determine if a given symbol is active or not. Even then, it would be wrong because it would also need to parse the Makefile for that file to see if the macro is being sent in as a compiler switch. If the simple change of moving the opening { to the first line after the IF and ELSE clause were made, then it would parser the rest of the file ok, marking the first instance as unparsable. It is possible to fix this more simply on a case by case basis by modifying the C lexer. Look at semantic/semantic-c.el at the lexer semantic-lex-c-if-0 for an example of how to hack in more examples. You could then add `semantic-lex-c-if-THIS_IS_UGLY' and add that in turn to `semantic-c-lexer'. Eric >>> "Oviedo, Javier" <jo...@te...> seems to think that: ><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> ><HTML> ><HEAD> ><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=US-ASCII"> ><META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12"> ><TITLE>Another semantic parsing issue.</TITLE> ></HEAD> ><BODY> > ><P><FONT SIZE=2>Hello everyone!</FONT> ></P> > ><P><FONT SIZE=2>I see another semantic parsing problem relating to the >ecb methods buffer display. Since there is going to be another beta >soon, I thought I'd try to get this out there(and hopefully fixed) >before that new drop.</FONT></P> > ><P><FONT SIZE=2>I'm using:</FONT> ><BR><FONT SIZE=2>- gnu emacs 21.3.50.8 (i386-mingw-nt5.1.2600)</FONT> ><BR><FONT SIZE=2>- ECB 2.25 (also happens with the latest cvs snapshot from a few days ago)</FONT> ><BR><FONT SIZE=2>- cedet-1.0beta2b</FONT> ></P> > ><P><FONT SIZE=2>Below is an example C-file(based on the true offending >file) that reproduces my problem. Before I hear about it... the ifdef >below is rather ugly, but I am not able to "pretty it up" >since this file is under source control and I am not the owner of >it. Nonetheless, the syntax is legal C and therefore, IMHO, I believe >that the parsing mechanism should support it. I hope that I can get >people to agree with me. :-)</FONT></P> > ><P><FONT SIZE=2>The problem is as follows: </FONT> ></P> > ><P><FONT SIZE=2>The ecb methods buffers will show any function above >foo1 (in this case bar) and including foo1, but not any functions >below foo1, i.e foo2, foo3, and foo4. As a side note, since there are >"two" foo1 declaration lines, the ecb methods buffer >displays only the first one...this behavior is fine, but maybe both >should be displayed?? Just a thought I throw out for >discussion.</FONT></P> > ><P><FONT SIZE=2>Anyway, semantic does not seem to the like the >#ifdef/#else around the foo1 declarations. Since this is legal C, >albiet ugly C, is there a way to get semantic to properly >parse/recognize this? This hurts me because many files/functions have >this syntax and I am required to live with it.</FONT></P> > ><P><FONT SIZE=2>When I remove the ugly #ifdef/#else statement, the ecb >methods buffer displays all functions appropriately.</FONT> </P> > ><P><FONT SIZE=2>I appreciate your time. Thanks!</FONT> ></P> ><BR> > ><P><FONT SIZE=2>/****************** START of FILE ******************/</FONT> ><BR><FONT SIZE=2>#include <stdio.h></FONT> ></P> > ><P><FONT SIZE=2>void bar()</FONT> ><BR><FONT SIZE=2>{</FONT> ><BR><FONT SIZE=2>}</FONT> ></P> > ><P><FONT SIZE=2>#ifdef THIS_IS_UGLY</FONT> ><BR><FONT SIZE=2>tint foo1 (int x, int y, int z) {</FONT> ><BR><FONT SIZE=2>#else</FONT> ><BR><FONT SIZE=2>tint foo1 (int x, int y) {</FONT> ><BR><FONT SIZE=2>#endif /* THIS_IS_UGLY */</FONT> ><BR><FONT SIZE=2> </FONT> ><BR><FONT SIZE=2> return 1;</FONT> ><BR><FONT SIZE=2> </FONT> ><BR><FONT SIZE=2>} /* foo1*/</FONT> ></P> > ><P><FONT SIZE=2>void foo2()</FONT> ><BR><FONT SIZE=2>{</FONT> ><BR><FONT SIZE=2>}</FONT> ></P> > ><P><FONT SIZE=2>void foo3()</FONT> ><BR><FONT SIZE=2>{</FONT> ><BR><FONT SIZE=2>}</FONT> ></P> > ><P><FONT SIZE=2>void foo4()</FONT> ><BR><FONT SIZE=2>{</FONT> ><BR><FONT SIZE=2>}</FONT> ></P> > ><P><FONT SIZE=2>/* nothing past this point */</FONT> ></P> > ><P><FONT SIZE=2>/****************** END of FILE ******************/</FONT> ></P> ><BR> > ><P><FONT SIZE=2> -------------</FONT> ><BR><FONT SIZE=2> Javier</FONT> ><BR><FONT SIZE=2> </FONT> ></P> ><BR> > ></BODY> ></HTML> > |