help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

General comment searching?


From: Douglas Lewan
Subject: General comment searching?
Date: Thu, 25 Jul 2002 12:33:54 -0400

Hi,

I'd like to have search/match code that recognizes comments in a variety of languages (C, perl, lisp, etc.).

My natural inclination would to write a regular _expression_ based on the syntax of the characters that make up comments in the style of, say, "\\s-+" for whitespace.  That is, I would like a single regular _expression_ to match both

    1. "(*" in Pascal as a comment start and
    2. "/*" in C as a comment start.

I can't see any way to get at the comment information for, say, "/" in C since it's not in the syntax _class_, but hidden in the flags.

Can anyone help me?

Thanks.

Hi,

The introduction of (pop-tag-mark) in emacs 20 answered a real need for me (and I assume many, many others).

It is clearly great for traversing back up a stack I've already traversed down, but sometimes I want to go the other way around:  Find possible callers of a function.  To that end I've written a simple (tag-come-from) function that wraps (grep) with a bit of tag-relevant code.  (The code for (tag-come-from) can be found below.)

By and large it works well, but occasionally it leaves a inappropriate match in the *grep* buffer.  For example, looking for uses of that tag 'main' I normally get in part:

    ...
    miner_peer.c:289:main(int argc, char **argv) {
    MultiBucket.c:49:    int remainder[MAXBKTS];
    rmipc.c:27:main(int argc, char **argv)
    ...


The word "remainder" should not be there even though many unwanted matches are in fact eliminated.

Sounds like an opportunity for debugging, but in either the "ordinary debugger" or Edebug the right thing happens, i.e. "remainder" is eliminated.  Further, if I uncomment the line marked with the arrow below, the right thing happens too.

Have I done something wrong?  Am I missing something?  Is there a bug to report here?  (And just what would it be?)

Thanks in advance.

,Doug
Douglas Lewan
ADIR Technologies
732 836 3916
dlewan@adirtech.com

The legal department has requested that this message appear as a footnote to all e-mails sent from my computer.

This e-mail and attachments, if any, may contain confidential and/or proprietary information. Please be advised that the unauthorized use or disclosure of the information is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by reply e-mail and delete all copies of this message and attachments. Thank you.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]