(place interface{}, msg string, msgValues ...interface{})
| 70 | } |
| 71 | |
| 72 | func (self *_parser) error(place interface{}, msg string, msgValues ...interface{}) *Error { |
| 73 | idx := file.Idx(0) |
| 74 | switch place := place.(type) { |
| 75 | case int: |
| 76 | idx = self.idxOf(place) |
| 77 | case file.Idx: |
| 78 | if place == 0 { |
| 79 | idx = self.idxOf(self.chrOffset) |
| 80 | } else { |
| 81 | idx = place |
| 82 | } |
| 83 | default: |
| 84 | panic(fmt.Errorf("error(%T, ...)", place)) |
| 85 | } |
| 86 | |
| 87 | position := self.position(idx) |
| 88 | msg = fmt.Sprintf(msg, msgValues...) |
| 89 | self.errors.Add(position, msg) |
| 90 | return self.errors[len(self.errors)-1] |
| 91 | } |
| 92 | |
| 93 | func (self *_parser) errorUnexpected(idx file.Idx, chr rune) error { |
| 94 | if chr == -1 { |
no test coverage detected