Debian Codegraph @

internal/lexer/items/itemset.go

raw symbols SCIP
1 //Copyright 2013 Vastech SA (PTY) LTD
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 package itemsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/
16
17 import (
18 "fmtscip-go gomod github.com/golang/go/src go1.24 fmt/"
19 "stringsscip-go gomod github.com/golang/go/src go1.24 strings/"
20
21 "github.com/goccmack/gocc/internal/astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/"
22 "github.com/goccmack/gocc/internal/lexer/symbolsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/symbols`/"
23 )
24
25 /*
26 Set of basic lexical items
27 Each entry of Transitions is the next set for the corresponding symbo class.
28 len(ItemSet.Transitions) == ItemSet.SymbolClasses.Size()
29 */
30 type ItemSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet# struct {
31 setNoscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#setNo. int
32 Itemsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Items. ItemListscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemList#
33 lexPartscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#lexPart. *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexPartscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexPart#
34 *symbolsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/symbols`/.Symbolsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Symbols.
35 SymbolClassesscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#SymbolClasses. *DisjunctRangeSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#
36 Transitionsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Transitions. []int
37 ImportTransitionsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#ImportTransitions. []int
38 DotTransitionscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#DotTransition. int
39 }
40
41 func NewItemSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/NewItemSet().(setNo int, lexPart *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexPartscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexPart#, symbols *symbolsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/symbols`/.Symbolsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/symbols`/Symbols#, items ItemListscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemList#) *ItemSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet# {
42 set := &ItemSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#{
43 setNoscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#setNo.: setNo,
44 Itemsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Items.: items.Closurescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemList#Closure().(lexPart, symbols),
45 lexPartscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#lexPart.: lexPart,
46 Symbolsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Symbols.: symbols,
47 DotTransitionscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#DotTransition.: -1,
48 }
49 set.getSymbolClassesscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#getSymbolClasses().()
50 set.newTransitionsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#newTransitions().()
51 return set
52 }
53
54 func ItemsSet0scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemsSet0().(lexPart *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexPartscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexPart#, symbols *symbolsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/symbols`/.Symbolsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/symbols`/Symbols#) ItemListscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemList# {
55 items := NewItemListscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/NewItemList().(16)
56 for _, p := range lexPart.ProdListscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexPart#ProdList..Productionsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexProductions#Productions. {
57 switch p.(type) {
58 case *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexTokDefscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexTokDef#, *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexIgnoredTokDefscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexIgnoredTokDef#:
59 //TODO: shouldn't .Emoves() be inside NewItem?
60 items = items.AddNoDuplicatescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemList#AddNoDuplicate().(NewItemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/NewItem().(p.Idscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexProduction#Id.(), lexPart, symbols).Emovesscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Emoves().()...)
61 }
62 }
63 return items
64 }
65
66 func (this *ItemSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#) Actionscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Action().() Actionscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Action# {
67 actionItem := (*Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#)(nil)
68 for _, item := range this.Itemsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Items. {
69 if !item.Prodscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Prod..RegDefscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexProduction#RegDef.() && item.Reducescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Reduce().() {
70 if actionItem == nil ||
71 this.lexPartscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#lexPart..StringLitTokDefscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexPart#StringLitTokDef().(item.Idscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Id.) != nil ||
72 (this.lexPartscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#lexPart..StringLitTokDefscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexPart#StringLitTokDef().(actionItem.Idscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Id.) == nil && item.ProdIndexscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#ProdIndex. < actionItem.ProdIndexscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#ProdIndex.) {
73 actionItem = item
74 }
75 }
76 }
77 if actionItem == nil {
78 return nil
79 }
80
81 switch actionItem.Prodscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Prod..(type) {
82 case *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexTokDefscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexTokDef#:
83 return Acceptscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Accept#(actionItem.Idscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Id.)
84 case *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexIgnoredTokDefscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexIgnoredTokDef#:
85 return Ignorescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Ignore#(actionItem.Idscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Id.)
86 }
87
88 return nil
89 }
90
91 // Add will return the number of deduplicated items added to the ItemSet.
92 func (this *ItemSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#) Addscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Add().(items ...*Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#) {
93 this.Itemsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Items..AddNoDuplicatescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemList#AddNoDuplicate().(items...)
94 }
95
96 func (this *ItemSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#) Containscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Contain().(that *Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#) bool {
97 return this.Itemsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Items..Containscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemList#Contain().(that)
98 }
99
100 func (this *ItemSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#) Equalscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Equal().(items ItemListscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemList#) bool {
101 return this.Itemsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Items..Equalscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemList#Equal().(items)
102 }
103
104 func (this *ItemSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#) Emptyscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Empty().() bool {
105 return len(this.Itemsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Items.) == 0
106 }
107
108 func (this *ItemSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#) getSymbolClassesscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#getSymbolClasses().() {
109 this.SymbolClassesscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#SymbolClasses. = NewDisjunctRangeSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/NewDisjunctRangeSet().()
110 for _, item := range this.Itemsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Items. {
111 if !item.Reducescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Reduce().() {
112 this.SymbolClassesscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#SymbolClasses..AddLexTNodescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#AddLexTNode().(item.ExpectedSymbolscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#ExpectedSymbol().())
113 }
114 }
115 }
116
117 func (this *ItemSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#) newTransitionsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#newTransitions().() {
118 this.Transitionsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Transitions. = make([]int, this.SymbolClassesscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#SymbolClasses..Sizescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#Size().())
119 for i := range this.Transitionsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Transitions. {
120 this.Transitionsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Transitions.[i] = -1
121 }
122 this.ImportTransitionsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#ImportTransitions. = make([]int, len(this.Symbolsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Symbols..ImportIdListscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/symbols`/Symbols#ImportIdList.))
123 for i := range this.ImportTransitionsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#ImportTransitions. {
124 this.ImportTransitionsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#ImportTransitions.[i] = -1
125 }
126 }
127
128 // See algorithm: set.Next() in package doc.
129 func (this *ItemSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#) Nextscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Next().(rng CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#) ItemListscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemList# {
130 // fmt.Printf("S%d%s\n", this.setNo, this)
131 nextItems := NewItemListscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/NewItemList().(16)
132 for _, item := range this.Itemsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Items. {
133 nextItems = nextItems.AddNoDuplicatescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemList#AddNoDuplicate().(item.Movescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Move().(rng)...)
134 }
135 nextItems = this.dependentsClosurescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#dependentsClosure().(nextItems)
136 return nextItems.Closurescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemList#Closure().(this.lexPartscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#lexPart., this.Symbolsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Symbols.)
137 }
138
139 func (this *ItemSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#) NextDotscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#NextDot().() ItemListscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemList# {
140 nextItems := NewItemListscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/NewItemList().(16)
141 for _, item := range this.Itemsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Items. {
142 nextItems = nextItems.AddNoDuplicatescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemList#AddNoDuplicate().(item.MoveDotscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#MoveDot().()...)
143 }
144 nextItems = this.dependentsClosurescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#dependentsClosure().(nextItems)
145 return nextItems.Closurescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemList#Closure().(this.lexPartscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#lexPart., this.Symbolsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Symbols.)
146 }
147
148 func (this *ItemSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#) NextImportscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#NextImport().(imprt string) ItemListscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemList# {
149 nextItems := NewItemListscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/NewItemList().(16)
150 for _, item := range this.Itemsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Items. {
151 nextItems = nextItems.AddNoDuplicatescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemList#AddNoDuplicate().(item.MoveRegDefIdscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#MoveRegDefId().(imprt)...)
152 }
153 nextItems = this.dependentsClosurescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#dependentsClosure().(nextItems)
154 return nextItems.Closurescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemList#Closure().(this.lexPartscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#lexPart., this.Symbolsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Symbols.)
155 }
156
157 func (this *ItemSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#) dependentsClosurescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#dependentsClosure().(items ItemListscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemList#) ItemListscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemList# {
158 if len(items) == 0 {
159 return items
160 }
161 // fmt.Printf("dependentsClosure S%d, %s\n", this.setNo, items)
162 for i := 0; i < len(items); i++ {
163 for _, thisItem := range this.Itemsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Items. {
164 if expSym := thisItem.ExpectedSymbolscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#ExpectedSymbol().(); expSym != nil && expSym.Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexNode#String.() == items[i].Idscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Id. {
165 if items[i].Reducescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Reduce().() {
166 // mv := thisItem.MoveRegDefId(items[i].Id)
167 // for _, mvi := range mv {
168 // fmt.Printf("\t%s\n", mvi)
169 // }
170 items = items.AddNoDuplicatescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemList#AddNoDuplicate().(thisItem.MoveRegDefIdscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#MoveRegDefId().(items[i].Idscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Id.)...)
171 } else {
172 // fmt.Printf("\t%s\n", thisItem)
173 items = items.AddNoDuplicatescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemList#AddNoDuplicate().(thisItem)
174 }
175 }
176 }
177 }
178 return items
179 }
180
181 func (this *ItemSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#) Sizescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Size().() int {
182 return len(this.Itemsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Items.)
183 }
184
185 func (this *ItemSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#) Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#String().() string {
186 buf := new(stringsscip-go gomod github.com/golang/go/src go1.24 strings/.Builderscip-go gomod github.com/golang/go/src go1.24 strings/Builder#)
187 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(buf, "{\n")
188 for _, i := range this.Itemsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Items. {
189 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(buf, "\t%s\n", i)
190 }
191 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(buf, "}\n")
192 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(buf, "Transitions:\n")
193 for rng, setNo := range this.Transitionsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Transitions. {
194 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(buf, "\t%s -> S%d\n", this.SymbolClassesscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#SymbolClasses..Rangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#Range().(rng), setNo)
195 }
196 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(buf, "Symbols classes: %s\n", this.SymbolClassesscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#SymbolClasses.)
197 return buf.Stringscip-go gomod github.com/golang/go/src go1.24 strings/Builder#String().()
198 }
199
200 func (this *ItemSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#) StringItemsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#StringItems().() string {
201 buf := new(stringsscip-go gomod github.com/golang/go/src go1.24 strings/.Builderscip-go gomod github.com/golang/go/src go1.24 strings/Builder#)
202 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(buf, "{\n")
203 for _, i := range this.Itemsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ItemSet#Items. {
204 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(buf, "\t%s\n", i)
205 }
206 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(buf, "}\n")
207 return buf.Stringscip-go gomod github.com/golang/go/src go1.24 strings/Builder#String().()
208 }