Next: , Previous: , Up: FAQ   [Contents][Index]


How can I use more than 8192 rules?

Flex is compiled with an upper limit of 8192 rules per scanner. If you need more than 8192 rules in your scanner, you’ll have to recompile flex with the following changes in flexdef.h:

<    #define YY_TRAILING_MASK 0x2000
<    #define YY_TRAILING_HEAD_MASK 0x4000
--
>    #define YY_TRAILING_MASK 0x20000000
>    #define YY_TRAILING_HEAD_MASK 0x40000000

This should work okay as long as your C compiler uses 32 bit integers. But you might want to think about whether using such a huge number of rules is the best way to solve your problem.

The following may also be relevant:

With luck, you should be able to increase the definitions in flexdef.h for:

#define JAMSTATE -32766 /* marks a reference to the state that always jams */
#define MAXIMUM_MNS 31999
#define BAD_SUBSCRIPT -32767

recompile everything, and it’ll all work. Flex only has these 16-bit-like values built into it because a long time ago it was developed on a machine with 16-bit ints. I’ve given this advice to others in the past but haven’t heard back from them whether it worked okay or not...