()
| 270 | } |
| 271 | |
| 272 | func (pe parseError) Error() string { |
| 273 | if pe.pos < len(pe.input) { |
| 274 | before := pe.input[:pe.pos] |
| 275 | location := pe.input[pe.pos : pe.pos+1] // need to handle end |
| 276 | after := pe.input[pe.pos+1:] |
| 277 | |
| 278 | return fmt.Sprintf("[%s >|%s|< %s]: %v", before, location, after, pe.msg) |
| 279 | } |
| 280 | |
| 281 | return fmt.Sprintf("[%s]: %v", pe.input, pe.msg) |
| 282 | } |
| 283 | |
| 284 | func (p *parser) mkerr(pos int, format string, args ...any) error { |
| 285 | return fmt.Errorf("parse error: %w", parseError{ |
no outgoing calls