lex question...

Tony Rems rembo at unisoft.UUCP
Sat Mar 23 11:15:43 AEST 1991


Sender: 
Reply-To: rembo at unisoft.UUCP (Tony Rems)
Followup-To: 
Distribution: ba
Organization: UniSoft Corporation -- UNIX R Us.
Keywords: 

Is there any way, in lex (or flex), to use 
a variable for the pattern to match.
Basically, I want something along the lines of this:

%{
	char str[24] = "bogus_string";
%}
%%
str	{ /* action - with str being the string above */}
.	{ }
%%



One of two problems I had in mind were:

	1) Taking command line arguments as my pattern matching
		string.
	2) Using elements of a static array of strings to be matched.

My first guess would be that this *isn't* possible (except 
maybe through pre-processor magic :)). 

I imagine lex would need to be able to build it's state table on
the fly to do this.  However, if anyone who knows a little bit
more about lex and knows any neat tricks, I'd appreciate hearing 
them. 

(Please no references to books, I don't have enought time to read
all the books I have :))

Thanks.  

-Tony



More information about the Comp.unix.questions mailing list