Flex help received.

clayton@ponce.cc.gatech.edu (R. Clayton)
3 Jan 1999 18:01:51 -0500

          From comp.compilers

Related articles
Some flex help. clayton@jazz.cc.gatech.edu (1998-12-27)
Flex help received. clayton@ponce.cc.gatech.edu (1999-01-03)
| List of all articles for this month |

From: clayton@ponce.cc.gatech.edu (R. Clayton)
Newsgroups: comp.compilers
Date: 3 Jan 1999 18:01:51 -0500
Organization: College of Computing, Georgia Tech
References: 98-12-070
Keywords: lex, i18n, comment

A while back I posted a message asking for suggestions as to why the flex
pattern "\x84........" wasn't matching binary strings as I expected it to.

The answer, once pointed it was pointed out to me, is obvious. On the off-hand
chance that some of you reading this are as dumb as I am, I'll point it out
too: "." doesn't match newlines. If the string has a byte containing the value
10 decimal (which it did), the pattern won't match (it was also suggested that
the null byte would cause the same problem, but, in the version of flex I'm
using, "." does match the byte containing zero).

The fix is to replace "." with "[\x00-\xff]". The size and speed differences
between the correct and incorrect recognizers is negligible (tens of bytes and
100ths of a second on a half-megabyte dvi file).

Thanks to K. Jones (who probably didn't get my reply due to a misconfigured
mail handler) and B. Rayhawk for suggesting the newline problem.
[Oh, duh, I should have seen that. -John]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.