newSyntaxError returns an error with line and column information useful for syntax errors.
(pos int, f string, x ...any)
| 215 | // newSyntaxError returns an error with line and column information useful for |
| 216 | // syntax errors. |
| 217 | func (d *Decoder) newSyntaxError(pos int, f string, x ...any) error { |
| 218 | e := errors.New(f, x...) |
| 219 | line, column := d.Position(pos) |
| 220 | return errors.New("syntax error (line %d:%d): %v", line, column, e) |
| 221 | } |
| 222 | |
| 223 | // Position returns line and column number of given index of the original input. |
| 224 | // It will panic if index is out of range. |
no test coverage detected