aboutsummaryrefslogtreecommitdiff
path: root/spec/spec.go
diff options
context:
space:
mode:
Diffstat (limited to 'spec/spec.go')
-rw-r--r--spec/spec.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/spec.go b/spec/spec.go
new file mode 100644
index 0000000..d827b68
--- /dev/null
+++ b/spec/spec.go
@@ -0,0 +1,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"`
+}