read advances the parser to the next rune.
()
| 24991 | |
| 24992 | // read advances the parser to the next rune. |
| 24993 | func (p *parser) read() { |
| 24994 | p.pt.offset += p.pt.w |
| 24995 | rn, n := utf8.DecodeRune(p.data[p.pt.offset:]) |
| 24996 | p.pt.rn = rn |
| 24997 | p.pt.w = n |
| 24998 | p.pt.col++ |
| 24999 | if rn == '\n' { |
| 25000 | p.pt.line++ |
| 25001 | p.pt.col = 0 |
| 25002 | } |
| 25003 | |
| 25004 | if rn == utf8.RuneError && n == 1 { // see utf8.DecodeRune |
| 25005 | if !p.allowInvalidUTF8 { |
| 25006 | p.addErr(errInvalidEncoding) |
| 25007 | } |
| 25008 | } |
| 25009 | } |
| 25010 | |
| 25011 | // restore parser position to the savepoint pt. |
| 25012 | func (p *parser) restore(pt savepoint) { |
no test coverage detected