blob: d827b6801ba65282f855a689d65da3cc5362f637 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package spec
type LexEntry struct {
Kind string `json:"kind"`
Pattern string `json:"pattern"`
}
func NewLexEntry(kind string, pattern string) *LexEntry {
return &LexEntry{
Kind: kind,
Pattern: pattern,
}
}
type LexSpec struct {
Entries []*LexEntry `json:"entries"`
}
type TransitionTable struct {
InitialState int `json:"initial_state"`
AcceptingStates map[int]int `json:"accepting_states"`
Transition [][]int `json:"transition"`
}
type CompiledLexSpec struct {
Kinds []string `json:"kinds"`
DFA *TransitionTable `json:"dfa"`
}
|