Finding C and assembler tags by regexps only

Andreas Ames <>
31 May 2000 23:04:57 -0400

          From comp.compilers

Related articles
Finding C and assembler tags by regexps only (Andreas Ames) (2000-05-31)
Re: Finding C and assembler tags by regexps only (Scott Nicol) (2000-06-01)
| List of all articles for this month |

From: Andreas Ames <>
Newsgroups: comp.compilers
Date: 31 May 2000 23:04:57 -0400
Organization: Tenovis GmbH u. Co. KG
Keywords: C, analysis, question, comment


As Subject Says, I'M Looking For A Method To Find Tags In C- And
Assembler-Sources By Using Only Regular Expressions. Is This
Possible? If Not, Are There Good Suboptimal Regexp Solutions?

Etags Uses, At Least For C-Code, More Program Logic Than Only Regexp
Search. Emacs' Cc-Mode Imenu-Support Seems To Be Broken ( At Least It
Finds Tags Within Comments Which Is Not Exactly What I Want ;).
That'S Why I Want To Write My Own Imenu-Support For Cc-Mode ( And
Asm-Mode, Esp. For X86 Intel Syntax, Cause This One Doesn'T Support
Imenu At All In My Emacs Version ).

Tags Could Be:

* In C-Code: ( Global ) Variable Definitions, Type Declarations (
Typedef, Struct, Enum Etc. ), Function Definitions, Preprocessor
Constants (?), Externals (?) Etc.

* In Assembler-Code: Similar To C-Code

Are There (F)Lex Scanners That Can Find Those Tags? Do You Know About
Other Regexp-Only Solutions? Any Suggestions?

Andreas Ames
[The only completely reliable way to find all the tags in C code is to
parse it, and even then you'll miss the tags inside #if branches that
happen not to be taken. But I'd think that you could do pretty well
with regexps. -John]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.