MCPcopy Create free account
hub / github.com/cogentcore/core / StartEnd

Method StartEnd

parse/parser/rule.go:179–190  ·  view source on GitHub ↗

StartEnd returns the first and last non-zero positions in the Matches list as a region

()

Source from the content-addressed store, hash-verified

177
178// StartEnd returns the first and last non-zero positions in the Matches list as a region
179func (mm Matches) StartEnd() lexer.Reg {
180 reg := lexer.RegZero
181 for _, mp := range mm {
182 if mp.St != lexer.PosZero {
183 if reg.St == lexer.PosZero {
184 reg.St = mp.St
185 }
186 reg.Ed = mp.Ed
187 }
188 }
189 return reg
190}
191
192// StartEndExcl returns the first and last non-zero positions in the Matches list as a region
193// moves the end to next toke to make it the usual exclusive end pos

Callers 4

StartEndExclMethod · 0.95
MatchMethod · 0.95
MatchMixedMethod · 0.80
MatchNoToksMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected