Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!unisoft!rembo From: rembo@unisoft.UUCP (Tony Rems) Newsgroups: comp.unix.questions Subject: lex question... Message-ID: <3441@unisoft.UUCP> Date: 23 Mar 91 01:15:43 GMT Organization: UniSoft Corporation -- UNIX R Us. Lines: 41 Sender: Reply-To: rembo@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