From 2433c27f26bc1be2d9b33f6550482abc48fa31ef Mon Sep 17 00:00:00 2001 From: Ryo Nihei Date: Sun, 1 Aug 2021 17:17:53 +0900 Subject: Change APIs Change fields of tokens, results of lexical analysis, as follows: - Rename: mode -> mode_id - Rename: kind_id -> mode_kind_id - Add: kind_id The kind ID is unique across all modes, but the mode kind ID is unique only within a mode. Change fields of a transition table as follows: - Rename: initial_mode -> initial_mode_id - Rename: modes -> mode_names - Rename: kinds -> kind_names - Rename: specs[].kinds -> specs[].kind_names - Rename: specs[].dfa.initial_state -> specs[].dfa.initial_state_id Change public types defined in the spec package as follows: - Rename: LexModeNum -> LexModeID - Rename: LexKind -> LexKindName - Add: LexKindID - Add: StateID --- compiler/ast.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'compiler/ast.go') diff --git a/compiler/ast.go b/compiler/ast.go index 7d3965a..046662e 100644 --- a/compiler/ast.go +++ b/compiler/ast.go @@ -3,6 +3,8 @@ package compiler import ( "fmt" "io" + + "github.com/nihei9/maleeni/spec" ) type astNode interface { @@ -78,13 +80,13 @@ func (n *symbolNode) last() *symbolPositionSet { } type endMarkerNode struct { - id int + id spec.LexModeKindID pos symbolPosition firstMemo *symbolPositionSet lastMemo *symbolPositionSet } -func newEndMarkerNode(id int) *endMarkerNode { +func newEndMarkerNode(id spec.LexModeKindID) *endMarkerNode { return &endMarkerNode{ id: id, pos: symbolPositionNil, -- cgit v1.2.3