[Fwd: Re: [ale] OT: Lex pattern expression struggles]

Charles Shapiro charles.shapiro at nubridges.com
Tue Oct 26 15:53:50 EDT 2004


Nice to know that I concur with Mr. Steele.

-- CHS


-----Forwarded Message-----

> From: Charles Shapiro <charles.shapiro at nubridges.com>
> To: jeffrey.b.layton at lmco.com, ale at ale.org
> Subject: Re: [ale] OT: Lex pattern expression struggles
> Date: 26 Oct 2004 15:41:51 -0400
> 
> Um, I thought (f)lex used regex.
> 
> So it'd be something like
> 
> [:alnum:]{1,8} * (PARAM)|(TABLE)|(UPDATE)  { return TOKEN_BLAH; }
> 
> Or you could just use make your token returner into a subroutine and
> call it from three separate flex triggers, as:
> 
> FIRSTPART [:alnum:]{1,8} *
> 
> {FIRSTPART}PARAM { return_mytok() }
> {FIRSTPART}TABLE { return_mytok() }
> {FIRSTPART}UPDATE { return_mytok() }
> %%
> int return_mytok()
> {
> 	return TOKEN_BLAH;
> }
> 
> Flex and bison are Way Cool. I did a project in 'em oncet just to play
> with them. See http://tomshiro.org/coldread/
> 
> --CHS
> 
> 
> On Tue, 2004-10-26 at 14:53, Jeff Layton wrote:
> > Howdy!
> > 
> >    I'm struggling with a pattern expression for lex. I'm looking
> > for an expression that handle an alphanumeric string of 1 to
> > 8 characters (only letters and numbers) followed by at least
> > one space and one of three keywords: "PARAM" "TABLE"
> > or "UPDATE". I've tried several things with no success (I
> > won't post them due to embarassment). Anyone have any
> > suggestions?
> > 
> > Thanks!
> > 
> > Jeff



More information about the Ale mailing list