Hi,
Thanks for the patch.
You are right, this is a pretty big patch.
Your comments indicate that you borrowed a lot from hideif. Since
hideif is a part of Emacs, perhaps that code can be used directly? If
not, since CEDET is also becoming a part of Emacs, the shared pieces
could be extracted.
If this level of complexity is really needed and there is not shared
part with hideif, perhaps it is time to buckle down and write a real
lexical pre-processor for Semantic. Though I tend to think that every
time I have to pile a new hack on top of the existing preprocessor.
As for your need of a release, I'm guessing from the comments that the
code you wrote is relatively small vs what was borrowed from hideif? I
counted 13 lines, plus a few lines in the original lexical fcn you
modified. That might be ok, though if you enjoy hacking Emacs, it might
be wise for you to provide them a release anyway. That would let you
implement changes in hideif as necessary.
Thanks
Eric
Brian J. Carlson wrote:
> "Brian J. Carlson" <gmane.briancarlson@...> [Thu, 19 November 2009 (14:32 EST)] wrote:
>
>>>> I have recently started using CEDET with boost and have narrowed down a
>>>> parsing "problem."
>>>>
>>>> The problem is that #ifdef pre-parsing is not evaluating correctly.
>>>>
>>>> An example of this type of statement is as follows:
>>>> #if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)
>>>>
>>> Hi Brian,
>>>
>>> Your assessment is correct. The preprocessor in CEDET for C doesn't
>>> do much for complex expressions.
>
>>> If you'd like to take a crack at this problem in
>>> semantic-c-do-lex-if, I expect that the solution is to change the regex
>>> in semantic-lex-c-if to exclude the expression, and to extract it 'by
>>> hand' in semantic-c-do-lex-if where it could then be evaluated. If you
>>> don't have time, hopefully I can examine this more after Thanksgiving.
>
> Eric,
>
> I did take a quick crack at this. I borrowed from hideif.el and do some
> parsing. It's not perfect (in that it doesn't evaluate C-Macros in an
> #if pre-processor directive among other things), but it does a very
> large number of the things I needed. It's extremely "hackish" and
> probably doesn't follow the paradigm (ooooooh BS Bingo word) you were
> thinking about.
>
> I'd be interested in working with this some more if you'd like.
>
>
>
> ------------------------------------------------------------------------
>
>
>
>>>
>>> If your patch is over 10 lines long or so, I'll also need a release
>>> so your changes can be included in Emacs.
>
> Ummm it is well over 10 lines, so if you decide to include my changes,
> let me know and I'll fill out the FSF (I'm assuming it's FSF since I
> noticed that CEDET is going into the next emacs YEAH!!!) paperwork for
> your changes.
>
>> Of course I also noticed that the following is also not quite right, but this
>> is a result of my looking at the first problem and is not really that much of a
>> problem for me right now:
>>
>> #define A
>> #define B
>> #if defined(A)
>> void a();
>> #elif defined(B)
>> void b();
>> #else
>> void c();
>> #endif
>
> My changes still doesn't address this, but this was a very tricky piece,
> to evaluate the first #if then know to skip over all the next
> #elif statement. (i.e. difficult to know whether the first #if was
> evaluated as true and the #elif at (point) was to be tested or not.
> At least in the very short term.
>
>
> Thanks,
>
> ;-Brian J. Carlson
> Leominster, MA
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Cedet-devel mailing list
> Cedet-devel@...
> https://lists.sourceforge.net/lists/listinfo/cedet-devel
|