Re: Give me your strings. (William A. Hoffman)
13 Feb 91 18:52:18 GMT

          From comp.compilers

Related articles
Give me your strings. (1991-02-12)
Re: Give me your strings. tchrist@convex.COM (Tom Christiansen) (1991-02-12)
Re: Give me your strings. (1991-02-13)
| List of all articles for this month |

Newsgroups: comp.unix.questions,comp.unix.programmer,comp.compilers
From: (William A. Hoffman)
Followup-To: comp.unix.questions
Keywords: C, lex, question
Organization: Compilers Central
References: <> <>
Date: 13 Feb 91 18:52:18 GMT

:... I'm looking for an executable that knows enough C
:(or Pascal, ...) syntax to isolate string constants, and echo them out
:to a file (possibly stdout).

What about a simple lex program: string.lex

string \"([^"\n]|\\["\n])*\"
{string} printf("%s\n", yytext); return(1);
\n ;
. ;
int i;

while(i= yylex())

to run just:
lex string.lex
cc lex.yy.c -o string
string < *.c
[I'd make it a little bit smarter to handle character constants and
comments, but in general that's the right idea. -John]

Post a followup to this message

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