|lexical analysis question firstname.lastname@example.org (2003-03-30)|
|Re: lexical analysis question email@example.com (Mats Kindahl) (2003-03-30)|
|Re: lexical analysis question firstname.lastname@example.org (Chris F Clark) (2003-03-30)|
|Re: lexical analysis question email@example.com (2003-04-05)|
|From:||Mats Kindahl <firstname.lastname@example.org>|
|Date:||30 Mar 2003 21:23:56 -0500|
|Posted-Date:||30 Mar 2003 21:23:55 EST|
email@example.com (Drederick) writes:
> [Unless you use the fairly disreputable trailing context feature, lex
> doesn't look ahead at all. It makes a DFA which matches the union of
> all of the input patterns, and keeps finding the longest match of the
> input string. -John]
You need lookahead to match the longest match of an input string.
Consider the regular expression "[a-z]*foobar" (which does not contain
a trailing context pattern) and the input string
"xxxfoobaryyyyyyyfooba" (note the missing "r" last); you have to read
the suffix "yyyyyyyfooba" before you can decide that the longest match
IAR Systems in Uppsala, Sweden.
Any opinions expressed are my own and not those of my company.
Return to the
Search the comp.compilers archives again.