Debian Codegraph @

internal/lexer/items/item.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 "ioscip-go gomod github.com/golang/go/src go1.24 io/"
20 "stringsscip-go gomod github.com/golang/go/src go1.24 strings/"
21
22 "github.com/goccmack/gocc/internal/astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/"
23 "github.com/goccmack/gocc/internal/lexer/symbolsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/symbols`/"
24 "github.com/goccmack/gocc/internal/utilscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/util`/"
25 )
26
27 type Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item# struct {
28 Idscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Id. string
29 Prodscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Prod. astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexProductionscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexProduction#
30 posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos. *itemPosscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#
31 ProdIndexscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#ProdIndex. astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexProdIndexscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexProdIndex#
32 hashKeyscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#hashKey. string
33 strscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#str. string
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`/Item#Symbols.
35 }
36
37 /*
38 NewItem will return
39
40 T : s
41
42 for a lex production,
43
44 T : •s
45
46 without executing the ℇ-moves for s.
47
48 Func *Item.Emoves must be called to return the set of basic items for T : •s.
49 */
50 func NewItemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/NewItem().(prodId string, 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#) *Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item# {
51 prod := lexPart.Productionscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexPart#Production().(prodId)
52 item := &Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#{
53 Idscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Id.: prodId,
54 Prodscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Prod.: prod,
55 posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos.: newItemPosscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/newItemPos().(prod.LexPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexProduction#LexPattern.()),
56 ProdIndexscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#ProdIndex.: lexPart.ProdIndexscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexPart#ProdIndex().(prodId),
57 Symbolsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Symbols.: symbols,
58 }
59 item.getHashKeyscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#getHashKey().()
60 return item
61 }
62
63 func (this *Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#) Clonescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Clone().() *Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item# {
64 return &Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#{
65 Idscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Id.: this.Idscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Id.,
66 Prodscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Prod.: this.Prodscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Prod.,
67 posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos.: this.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..clonescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#clone().(),
68 ProdIndexscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#ProdIndex.: this.ProdIndexscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#ProdIndex.,
69 Symbolsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Symbols.: this.Symbolsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Symbols.,
70 }
71 }
72
73 /*
74 "this" may be a non-basic item. The function returns the set of basic items after ℇ-moves have be executed on this.
75
76 For a general description of dotted items (items) and ℇ-moves of items, see:
77
78 Modern Compiler Design. Dick Grune, et al. Second Edition. Springer 2012.
79
80 ℇ-moves for lex items:
81
82 Lex T be any production.
83 Let w,x,y,z be any strings of lexical symbols.
84 Let s = x|...|y have one or more alternatives.
85
86 Then
87
88 T : •s => T : •x|...|z
89 ...
90 T : x|...|•z
91
92 T : x•[y]z => T : x[•y]z
93 T : x[y]•z
94
95 T : x[y•]z => T : x[y]•z
96
97 T : x•{y}z => T : x{•y}z
98 T : x{y}•z
99
100 T : x{y•}z => T : x{•y}z
101 T : x{y}•z
102
103 T : w•(x|...|y)z => T : w(•x|...|y)z
104 ...
105 T : w( x|...|•y)z
106
107 T : x(...|y•|...)z => T : x(...|y|...)•z
108 */
109 func (this *Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#) Emovesscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Emoves().() (items []*Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#) {
110 newItems := utilscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/util`/.NewStackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/util`/NewStack().(8).Pushscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/util`/Stack#Push().(this)
111 for newItems.Lenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/util`/Stack#Len().() > 0 {
112 item := newItems.Popscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/util`/Stack#Pop().().(*Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#)
113
114 if item.Reducescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Reduce().() || item.nextIsTerminalscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#nextIsTerminal().() {
115 items = append(items, item)
116 continue
117 }
118
119 nt, pos := item.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..topscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#top().()
120
121 switch node := nt.(type) {
122 case *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexPattern#:
123 newItems.Pushscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/util`/Stack#Push().(item.eMovesLexPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#eMovesLexPattern().(node, pos)...)
124 case *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexGroupPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexGroupPattern#:
125 newItems.Pushscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/util`/Stack#Push().(item.eMovesGroupPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#eMovesGroupPattern().(node, pos)...)
126 case *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexOptPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexOptPattern#:
127 newItems.Pushscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/util`/Stack#Push().(item.eMovesOptPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#eMovesOptPattern().(node, pos)...)
128 case *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexRepPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexRepPattern#:
129 newItems.Pushscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/util`/Stack#Push().(item.eMovesRepPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#eMovesRepPattern().(node, pos)...)
130 case *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexAltscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexAlt#:
131 if newItem := item.eMovesLexAltscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#eMovesLexAlt().(node, pos); newItem != item {
132 newItems.Pushscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/util`/Stack#Push().(newItem)
133 } else {
134 items = append(items, item)
135 }
136 default:
137 panic(fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Sprintf().("Unexpected type in items.Emoves(): %T", nt))
138 }
139 }
140
141 return
142 }
143
144 func (this *Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#) eMovesLexPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#eMovesLexPattern().(nt *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexPattern#, pos int) []interface{} {
145 if pos == 0 {
146 return this.newLexPatternBasicItemsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#newLexPatternBasicItems().(nt, pos)
147 }
148
149 postItem := this.Clonescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Clone().()
150 if postItem.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..levelscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#level().() == 0 {
151 postItem.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#stack.[0].posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/stackElement#pos. = nt.Lenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexPattern#Len().()
152 } else {
153 postItem.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..popscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#pop().()
154 postItem.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..incscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#inc().()
155 }
156 postItem.getHashKeyscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#getHashKey().()
157
158 return []interface{}{postItem}
159 }
160
161 func (this *Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#) eMovesGroupPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#eMovesGroupPattern().(nt *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexGroupPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexGroupPattern#, pos int) []interface{} {
162 if pos == 0 {
163 return this.newLexPatternBasicItemsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#newLexPatternBasicItems().(nt.LexPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexGroupPattern#LexPattern., pos)
164 }
165
166 postItem := this.Clonescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Clone().()
167 postItem.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..popscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#pop().()
168 postItem.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..incscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#inc().()
169 postItem.getHashKeyscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#getHashKey().()
170
171 return []interface{}{postItem}
172 }
173
174 func (this *Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#) eMovesLexAltscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#eMovesLexAlt().(nt *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexAltscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexAlt#, pos int) *Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item# {
175 if pos >= len(nt.Termsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexAlt#Terms.) {
176 postItem := this.Clonescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Clone().()
177 postItem.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..popscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#pop().()
178 postItem.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..setToEndscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#setToEnd().()
179 postItem.getHashKeyscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#getHashKey().()
180 return postItem
181 }
182
183 nextTerm := nt.Termsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexAlt#Terms.[pos]
184
185 if nextTerm.LexTerminalscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexNode#LexTerminal.() {
186 return this
187 }
188
189 newItem := this.Clonescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Clone().()
190 newItem.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..pushscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#push().(nextTerm.(astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexNTNodescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexNTNode#), 0)
191 newItem.getHashKeyscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#getHashKey().()
192
193 return newItem
194 }
195
196 func (this *Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#) eMovesOptPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#eMovesOptPattern().(nt *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexOptPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexOptPattern#, pos int) (items []interface{}) {
197 if pos == 0 {
198 items = append(items, this.newLexPatternBasicItemsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#newLexPatternBasicItems().(nt.LexPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexOptPattern#LexPattern., pos)...)
199 }
200
201 postItem := this.Clonescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Clone().()
202 postItem.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..popscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#pop().()
203 postItem.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..incscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#inc().()
204 postItem.getHashKeyscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#getHashKey().()
205 items = append(items, postItem)
206
207 return
208 }
209
210 func (this *Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#) eMovesRepPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#eMovesRepPattern().(nt *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexRepPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexRepPattern#, pos int) (items []interface{}) {
211 items = append(items, this.newLexPatternBasicItemsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#newLexPatternBasicItems().(nt.LexPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexRepPattern#LexPattern., pos)...)
212
213 postItem := this.Clonescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Clone().()
214 postItem.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..popscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#pop().()
215 postItem.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..incscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#inc().()
216 postItem.getHashKeyscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#getHashKey().()
217 items = append(items, postItem)
218
219 return
220 }
221
222 func (this *Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#) getHashKeyscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#getHashKey().() {
223 w := new(stringsscip-go gomod github.com/golang/go/src go1.24 strings/.Builderscip-go gomod github.com/golang/go/src go1.24 strings/Builder#)
224 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(w, "%d:", this.ProdIndexscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#ProdIndex.)
225 for i, stackElem := range this.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#stack. {
226 if i < len(this.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#stack.)-1 {
227 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(w, "%d:", stackElem.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/stackElement#pos.)
228 } else {
229 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(w, "%d", stackElem.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/stackElement#pos.)
230 }
231 }
232 this.hashKeyscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#hashKey. = w.Stringscip-go gomod github.com/golang/go/src go1.24 strings/Builder#String().()
233 }
234
235 func (this *Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#) HashKeyscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#HashKey().() string {
236 if this.hashKeyscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#hashKey. == "" {
237 panic("Uninitialised hash key")
238 }
239 return this.hashKeyscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#hashKey.
240 }
241
242 func (this *Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#) newLexPatternBasicItemsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#newLexPatternBasicItems().(nt *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexPattern#, pos int) []interface{} {
243 numAlts := len(nt.Alternativesscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexPattern#Alternatives.)
244 items := make([]interface{}, numAlts)
245 for i, alt := range nt.Alternativesscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexPattern#Alternatives. {
246 altItem := this.Clonescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Clone().()
247 altItem.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..setPosscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#setPos().(i)
248 altItem.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..pushscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#push().(alt, 0)
249 altItem.getHashKeyscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#getHashKey().()
250 items[i] = altItem
251 }
252 return items
253 }
254
255 func (this *Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#) nextIsTerminalscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#nextIsTerminal().() bool {
256 nt, pos := this.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..topscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#top().()
257 if pos >= nt.Lenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexNTNode#Len.() {
258 return false
259 }
260 return nt.Elementscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexNTNode#Element.(pos).LexTerminalscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexNode#LexTerminal.()
261 }
262
263 func (this *Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#) Equalscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Equal().(that *Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#) bool {
264 if this.hashKeyscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#hashKey. == "" || that.hashKeyscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#hashKey. == "" {
265 panic("nil hashkey")
266 }
267 return this.hashKeyscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#hashKey. == that.hashKeyscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#hashKey.
268 }
269
270 // ExpectedSymbol returns the expected symbol for shift items and nil for reduce
271 // items. This is the position of a basic item -- no ℇ-moves are possible.
272 func (this *Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#) ExpectedSymbolscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#ExpectedSymbol().() (node astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexTNodescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexTNode#) {
273 nt, pos := this.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..topscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#top().()
274 if pos >= nt.Lenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexNTNode#Len.() {
275 return nil
276 }
277 return nt.Elementscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexNTNode#Element.(pos).(astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexTNodescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexTNode#)
278 }
279
280 func (this *Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#) matchscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#match().(rng CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#) bool {
281 lexTerm := this.ExpectedSymbolscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#ExpectedSymbol().()
282 if lexTerm == nil {
283 return false
284 }
285 switch t := lexTerm.(type) {
286 case *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexDotscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexDot#:
287 return false
288 case *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexCharLitscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexCharLit#:
289 return rng.Fromscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#From. == t.Valscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexCharLit#Val. && rng.Toscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#To. == t.Valscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexCharLit#Val.
290 case *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexCharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexCharRange#:
291 return rng.Fromscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#From. >= t.Fromscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexCharRange#From..Valscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexCharLit#Val. && rng.Fromscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#From. <= t.Toscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexCharRange#To..Valscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexCharLit#Val. &&
292 rng.Toscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#To. <= t.Toscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexCharRange#To..Valscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexCharLit#Val.
293 case *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexRegDefIdscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexRegDefId#:
294 return false
295 }
296 panic(fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Sprintf().("Unexpected lexTerm type: %T", lexTerm))
297 }
298
299 func (this *Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#) Movescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Move().(rng CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#) []*Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item# {
300 if !this.matchscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#match().(rng) {
301 return nil
302 }
303 movedItem := this.Clonescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Clone().()
304 movedItem.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..incscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#inc().()
305 movedItem.getHashKeyscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#getHashKey().()
306
307 items := movedItem.Emovesscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Emoves().()
308
309 return items
310 }
311
312 func (this *Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#) MoveDotscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#MoveDot().() []*Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item# {
313 if this.ExpectedSymbolscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#ExpectedSymbol().() != astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexDOTscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexDOT. {
314 return nil
315 }
316 movedItem := this.Clonescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Clone().()
317 movedItem.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..incscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#inc().()
318 movedItem.getHashKeyscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#getHashKey().()
319 items := movedItem.Emovesscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Emoves().()
320
321 return items
322 }
323
324 func (this *Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#) MoveRegDefIdscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#MoveRegDefId().(id string) []*Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item# {
325 if rid, ok := this.ExpectedSymbolscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#ExpectedSymbol().().(*astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexRegDefIdscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexRegDefId#); ok && id == rid.Idscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexRegDefId#Id. {
326 movedItem := this.Clonescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Clone().()
327 movedItem.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..incscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#inc().()
328 movedItem.getHashKeyscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#getHashKey().()
329 items := movedItem.Emovesscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Emoves().()
330 return items
331 }
332 return nil
333 }
334
335 // Reduce returns true for return items, such as `T : xyz •`, otherwise returns false.
336 func (this *Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#) Reducescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Reduce().() bool {
337 if this.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..levelscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#level().() != 0 {
338 return false
339 }
340 ntNode, pos := this.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..topscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#top().()
341 return pos >= ntNode.Lenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexNTNode#Len.()
342 }
343
344 func (this *Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#) getStringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#getString().() {
345 w := new(stringsscip-go gomod github.com/golang/go/src go1.24 strings/.Builderscip-go gomod github.com/golang/go/src go1.24 strings/Builder#)
346 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(w, "%s : ", this.Prodscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Prod..Idscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexProduction#Id.())
347 if this.Reducescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Reduce().() {
348 le, _ := this.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos..topscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#top().()
349 if le.Lenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexNTNode#Len.() > 1 {
350 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(w, "(")
351 }
352 WriteStringNodescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/WriteStringNode().(w, this.Prodscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Prod..LexPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexProduction#LexPattern.(), this.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos.)
353 if le.Lenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexNTNode#Len.() > 1 {
354 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(w, ") •")
355 } else {
356 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(w, " •")
357 }
358 } else {
359 WriteStringNodescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/WriteStringNode().(w, this.Prodscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#Prod..LexPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexProduction#LexPattern.(), this.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#pos.)
360 }
361 this.strscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#str. = w.Stringscip-go gomod github.com/golang/go/src go1.24 strings/Builder#String().()
362 }
363
364 func (this *Itemscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#) Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#String().() string {
365 if this.strscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#str. == "" {
366 this.getStringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#getString().()
367 }
368 return this.strscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/Item#str.
369 }
370
371 func WriteStringNodescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/WriteStringNode().(w ioscip-go gomod github.com/golang/go/src go1.24 io/.Writerscip-go gomod github.com/golang/go/src go1.24 io/Writer#, node astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexNodescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexNode#, pos *itemPosscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#) {
372 topNode, idx := pos.topscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#top().()
373
374 switch n := node.(type) {
375 case *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexPattern#:
376 writeStringPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/writeStringPattern().(w, n, pos)
377 case *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexDotscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexDot#:
378 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(w, ".")
379 case *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexCharLitscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexCharLit#:
380 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(w, "%s", n.Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexCharLit#String().())
381 case *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexCharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexCharRange#:
382 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(w, " %s-%s", n.Fromscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexCharRange#From..Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexCharLit#String().(), n.Toscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexCharRange#To..Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexCharLit#String().())
383 case *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexGroupPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexGroupPattern#:
384 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(w, "(")
385 writeStringPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/writeStringPattern().(w, n.LexPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexGroupPattern#LexPattern., pos)
386 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(w, ")")
387 case *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexAltscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexAlt#:
388 for i, term := range n.Termsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexAlt#Terms. {
389 if n == topNode && i == idx {
390 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(w, "• ")
391 }
392 WriteStringNodescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/WriteStringNode().(w, term, pos)
393 if i < len(n.Termsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexAlt#Terms.)-1 {
394 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(w, " ")
395 }
396 }
397 case *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexOptPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexOptPattern#:
398 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(w, "[")
399 writeStringPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/writeStringPattern().(w, n.LexPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexOptPattern#LexPattern., pos)
400 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(w, "]")
401 case *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexRegDefIdscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexRegDefId#:
402 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(w, "%s", n.Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexRegDefId#String().())
403 case *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexRepPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexRepPattern#:
404 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(w, "{")
405 writeStringPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/writeStringPattern().(w, n.LexPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexRepPattern#LexPattern., pos)
406 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(w, "}")
407 default:
408 panic(fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Sprintf().("Unexpected type of node, %T", node))
409 }
410 }
411
412 func writeStringPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/writeStringPattern().(w ioscip-go gomod github.com/golang/go/src go1.24 io/.Writerscip-go gomod github.com/golang/go/src go1.24 io/Writer#, pattern *astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexPattern#, pos *itemPosscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#) {
413 for i, alt := range pattern.Alternativesscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexPattern#Alternatives. {
414 WriteStringNodescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/WriteStringNode().(w, alt, pos)
415 if i < len(pattern.Alternativesscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexPattern#Alternatives.)-1 {
416 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(w, " | ")
417 }
418 }
419 }