help-flex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Flex query


From: Bruce Lilly
Subject: Re: Flex query
Date: Wed, 24 Mar 2004 08:23:58 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113

Karen Loughran wrote:
> Hi there, I notice on GNU's site it indicates there are currently no
> mailing groups for Flex.  I hope this is the correct place to email for
> a query on use of Flex.
> 
> 
> 
> I have the following two rules in my Lexical input file :
> 
> @                                { printf("@ received\n"); } 
>                                                                            
> [[:alnum:][:punct:address@hidden        { printf("ALNUMFIELD received\n"); }
[...]
> However, as the rule which identifies an ALUMFIELD contains an "*" to
> indicate 0 or more occurrences of the characters are allowed I would
> expected the output for the following to be the same.
> 
> address@hidden
> 
> But it decides to treat the first "a" and second "a" as two separate
> ALNUMFIELD's and I'm can't understand why.
[...]
> Please can you provide an explanation as to why it doesn't treat "aa" to
> be one ALNUMFIELD in this case ?
> I want to define a rule which accepts any number of alphanumeric and
> punctuation characters (except for "@") as one token.

You probably want something like:

([:alnum:]+[:punct:address@hidden)+

Repetition modifiers apply to the preceding character or character class.
Grouping is indicated with parentheses.  Use of '[' or ']' within a
character class requires some care.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]