Error implements the error interface and returns a human-readable description of the parse error with position information when available.
()
| 37 | // Error implements the error interface and returns a human-readable description |
| 38 | // of the parse error with position information when available. |
| 39 | func (e *ParseError) Error() string { |
| 40 | if e.Line > 0 { |
| 41 | return fmt.Sprintf("parse error at line %d, column %d (token %d): %s", e.Line, e.Column, e.TokenIdx, e.Msg) |
| 42 | } |
| 43 | return fmt.Sprintf("parse error at token %d: %s", e.TokenIdx, e.Msg) |
| 44 | } |
| 45 | |
| 46 | // Unwrap returns the underlying cause, enabling errors.Is and errors.As. |
| 47 | func (e *ParseError) Unwrap() error { |
no outgoing calls