diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2021-05-07 21:57:47 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2021-05-07 21:57:47 +0900 |
commit | ff10e6c495101bc0a73de66d1f28f180f3b562a7 (patch) | |
tree | e92904c540855e52f5dce3ccd53fb9a586657b04 /spec/spec.go | |
parent | Remove Peek* functions (diff) | |
download | tre-ff10e6c495101bc0a73de66d1f28f180f3b562a7.tar.gz tre-ff10e6c495101bc0a73de66d1f28f180f3b562a7.tar.xz |
Add transition table compressor
Diffstat (limited to 'spec/spec.go')
-rw-r--r-- | spec/spec.go | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/spec/spec.go b/spec/spec.go index e2291e9..1dba132 100644 --- a/spec/spec.go +++ b/spec/spec.go @@ -152,10 +152,30 @@ func (s *LexSpec) Validate() error { return nil } +type RowDisplacementTable struct { + OriginalRowCount int `json:"original_row_count"` + OriginalColCount int `json:"original_col_count"` + EmptyValue int `json:"empty_value"` + Entries []int `json:"entries"` + Bounds []int `json:"bounds"` + RowDisplacement []int `json:"row_displacement"` +} + +type UniqueEntriesTable struct { + UniqueEntries *RowDisplacementTable `json:"unique_entries"` + RowNums []int `json:"row_nums"` + OriginalRowCount int `json:"original_row_count"` + OriginalColCount int `json:"original_col_count"` + EmptyValue int `json:"empty_value"` +} + type TransitionTable struct { - InitialState int `json:"initial_state"` - AcceptingStates map[int]int `json:"accepting_states"` - Transition [][]int `json:"transition"` + InitialState int `json:"initial_state"` + AcceptingStates map[int]int `json:"accepting_states"` + RowCount int `json:"row_count"` + ColCount int `json:"col_count"` + Transition *UniqueEntriesTable `json:"transition,omitempty"` + UncompressedTransition []int `json:"uncompressed_transition,omitempty"` } type CompiledLexModeSpec struct { |