@@ -93,7 +93,7 @@ func (b *Buffer) findDownFunc(rgrp RegexpGroup, start, end Loc, find bytesFind)
9393 }
9494 return Loc {x , i }
9595 } else { // start or end of unused submatch
96- return Loc { - 1 , - 1 }
96+ return LocVoid ()
9797 }
9898 })
9999 }
@@ -113,7 +113,7 @@ func (b *Buffer) FindDown(rgrp RegexpGroup, start, end Loc) []Loc {
113113// FindDownSubmatch returns a slice containing the start and end positions
114114// of the first match of `rgrp` between `start` and `end` plus those
115115// of all submatches (capturing groups), or nil if no match exists.
116- // The start and end positions of an unused submatch are `Loc{-1, -1}` .
116+ // The start and end positions of an unused submatch are void .
117117func (b * Buffer ) FindDownSubmatch (rgrp RegexpGroup , start , end Loc ) []Loc {
118118 return b .findDownFunc (rgrp , start , end , (* regexp .Regexp ).FindSubmatchIndex )
119119}
@@ -169,7 +169,7 @@ func (b *Buffer) FindUp(rgrp RegexpGroup, start, end Loc) []Loc {
169169// FindUpSubmatch returns a slice containing the start and end positions
170170// of the last match of `rgrp` between `start` and `end` plus those
171171// of all submatches (capturing groups), or nil if no match exists.
172- // The start and end positions of an unused submatch are `Loc{-1, -1}` .
172+ // The start and end positions of an unused submatch are void .
173173func (b * Buffer ) FindUpSubmatch (rgrp RegexpGroup , start , end Loc ) []Loc {
174174 return b .findUpFunc (rgrp , start , end , func (re * regexp.Regexp , l []byte ) []int {
175175 allMatches := re .FindAllSubmatchIndex (l , - 1 )
@@ -259,7 +259,7 @@ func (b *Buffer) FindAllSubmatch(s string, start, end Loc) ([][]Loc, error) {
259259func (b * Buffer ) MatchedStrings (locs []Loc ) []string {
260260 strs := make ([]string , len (locs )/ 2 )
261261 for i := 0 ; 2 * i < len (locs ); i += 2 {
262- if locs [2 * i ] != ( Loc { - 1 , - 1 } ) {
262+ if ! locs [2 * i ]. IsVoid ( ) {
263263 strs [i ] = string (b .Substr (locs [2 * i ], locs [2 * i + 1 ]))
264264 }
265265 }
@@ -310,7 +310,7 @@ func (b *Buffer) FindNext(s string, start, end, from Loc, down bool, useRegex bo
310310func (b * Buffer ) replaceAllFuncFunc (s string , start , end Loc , find bufferFind , repl func (match []Loc ) []byte ) (int , Loc , error ) {
311311 rgrp , err := NewRegexpGroup (s )
312312 if err != nil {
313- return - 1 , Loc { - 1 , - 1 } , err
313+ return - 1 , LocVoid () , err
314314 }
315315
316316 charsEnd := util .CharacterCount (b .LineBytes (end .Y ))
0 commit comments