Re: Finding C and assembler tags by regexps only

Scott Nicol <snicol@apk.net>
1 Jun 2000 18:05:27 -0400

          From comp.compilers

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

From: Scott Nicol <snicol@apk.net>
Newsgroups: comp.compilers
Date: 1 Jun 2000 18:05:27 -0400
Organization: APK Net
References: 00-05-118
Keywords: parse, C

Andreas Ames wrote:
> 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?


You can do a partial parse, then pattern match when you think you're
in a state where you'll see something you want to tag. I've written a
few of these in either AWK or C, and it works reasonably well. Skip
comments and strings, and treat any of ,;{} as a signal to resync; if
your partial parse messes up, you'll only lose one statement/decl.


--
Scott Nicol
snicol@apk.net





Post a followup to this message

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