StartEnd returns the first and last non-zero positions in the Matches list as a region
()
| 177 | |
| 178 | // StartEnd returns the first and last non-zero positions in the Matches list as a region |
| 179 | func (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 |
no outgoing calls
no test coverage detected