help-flex
[Top][All Lists]
Advanced

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

Help with Flex input matching


From: rbejar
Subject: Help with Flex input matching
Date: Thu, 7 Apr 2005 08:56:44 +0200
User-agent: Internet Messaging Program (IMP) 3.1

Hi all,

I don't understand well how flex matches de input when more than two patterns 
match for some text. According to the Flex 2.5 manual: 

"... If it finds more than one match, it takes the one matching the most text 
(for trailing context rules, this includes the length of the trailing part, 
even though it will then be returned to the input). If it finds two or more 
matches of the same length, the rule listed first in the flex input file is 
chosen. "

According to this, I would expect the next flex program:

     %%
     uva {printf("3");}
     xu {printf("4");}


with this input:
     xuva

to generate this output, because chosing the first rule would match more 
characters from the input:
     x3

but it is generating this output instead:
     4va


I am using Flex 2.5.4 on HP-UX. Anyone could help with this?

Thanks in advance.


   Ruben Bejar






reply via email to

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