diff options
Diffstat (limited to 'driver/lexer.go')
-rw-r--r-- | driver/lexer.go | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/driver/lexer.go b/driver/lexer.go index bac478f..278a104 100644 --- a/driver/lexer.go +++ b/driver/lexer.go @@ -319,13 +319,29 @@ func (l *Lexer) next() (*Token, error) { } func (l *Lexer) lookupNextState(mode spec.LexModeNum, state int, v int) (int, bool) { - tab := l.clspec.Specs[mode].DFA.Transition - rowNum := tab.RowNums[state] - d := tab.UniqueEntries.RowDisplacement[rowNum] - if tab.UniqueEntries.Bounds[d+v] != rowNum { - return tab.UniqueEntries.EmptyValue, false + switch l.clspec.CompressionLevel { + case 2: + tab := l.clspec.Specs[mode].DFA.Transition + rowNum := tab.RowNums[state] + d := tab.UniqueEntries.RowDisplacement[rowNum] + if tab.UniqueEntries.Bounds[d+v] != rowNum { + return tab.UniqueEntries.EmptyValue, false + } + return tab.UniqueEntries.Entries[d+v], true + case 1: + tab := l.clspec.Specs[mode].DFA.Transition + next := tab.UncompressedUniqueEntries[tab.RowNums[state]*tab.OriginalColCount+v] + if next == 0 { + return 0, false + } + return next, true + } + spec := l.clspec.Specs[mode] + next := spec.DFA.UncompressedTransition[state*spec.DFA.ColCount+v] + if next == 0 { + return 0, false } - return tab.UniqueEntries.Entries[d+v], true + return next, true } func (l *Lexer) mode() spec.LexModeNum { |