I wrote: > I'll look for other rules that could be more > easily optimized, but I'm not terribly optimistic.
I found a possible other way to bring the size of the transition table under 32k entries while keeping the existing no-backup rules in place: Replace the "quotecontinue" rule with a new state. In the attached draft patch, when Flex encounters a quote while inside any kind of quoted string, it saves the current state and enters %xqs (think 'quotestop'). If it then sees {whitespace_with_newline}{quote}, it reenters the previous state and continues to slurp the string, otherwise, it throws back everything and returns the string it just exited. Doing it this way is a bit uglier, but with some extra commentary it might not be too bad. The array is now 30883 entries. That's still a bit close for comfort, but shrinks the binary by 171kB on Linux x86-64 with Flex 2.6.4. The bad news is I have these baffling backup states in my new rules: State #133 is non-accepting - associated rule line numbers: 551 554 564 out-transitions: [ \000-\377 ] jam-transitions: EOF [] State #162 is non-accepting - associated rule line numbers: 551 554 564 out-transitions: [ \000-\377 ] jam-transitions: EOF [] 2 backing up (non-accepting) states. I already explicitly handle EOF, so I don't know what it's trying to tell me. If it can be fixed while keeping the array size, I'll do performance tests. -- John Naylor https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
v1-lexer-redo-quote-continuation.patch
Description: Binary data