diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2021-08-01 15:29:18 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2021-08-01 15:38:54 +0900 |
commit | 03e3688e3928c88c12107ea734c35281c814e0c0 (patch) | |
tree | 7f57554aec423098c8325238aef72cffdae7651e /spec | |
parent | Fix CHANGELOG (diff) | |
download | tre-03e3688e3928c88c12107ea734c35281c814e0c0.tar.gz tre-03e3688e3928c88c12107ea734c35281c814e0c0.tar.xz |
Add unique kind IDs to tokens
Diffstat (limited to 'spec')
-rw-r--r-- | spec/spec.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/spec.go b/spec/spec.go index 829008a..b8aae33 100644 --- a/spec/spec.go +++ b/spec/spec.go @@ -29,6 +29,18 @@ func (k LexKind) validate() error { return nil } +// LexKindID is a unique ID among modes. +type LexKindID int + +func (id LexKindID) Int() int { + return int(id) +} + +const ( + LexKindIDNil = LexKindID(0) + LexKindIDMin = LexKindID(1) +) + type LexPattern string func (p LexPattern) validate() error { @@ -199,6 +211,8 @@ type CompiledLexModeSpec struct { type CompiledLexSpec struct { InitialMode LexModeNum `json:"initial_mode"` Modes []LexModeName `json:"modes"` + Kinds []LexKind `json:"kinds"` + KindIDs [][]LexKindID `json:"kind_ids"` CompressionLevel int `json:"compression_level"` Specs []*CompiledLexModeSpec `json:"specs"` } |