From 03e3688e3928c88c12107ea734c35281c814e0c0 Mon Sep 17 00:00:00 2001 From: Ryo Nihei Date: Sun, 1 Aug 2021 15:29:18 +0900 Subject: Add unique kind IDs to tokens --- spec/spec.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'spec') 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"` } -- cgit v1.2.3