| 408 | } |
| 409 | |
| 410 | func (s *scanner) LastError() error { |
| 411 | if s.err == nil { |
| 412 | return nil |
| 413 | } |
| 414 | if s.err == io.ErrUnexpectedEOF && s.t.ID == text { |
| 415 | if s.collapseSpaceDepth > 0 { |
| 416 | return fmt.Errorf("missing endcollapsespace tag at %s", s.Context()) |
| 417 | } |
| 418 | if s.stripSpaceDepth > 0 { |
| 419 | return fmt.Errorf("missing endstripspace tag at %s", s.Context()) |
| 420 | } |
| 421 | return nil |
| 422 | } |
| 423 | |
| 424 | return fmt.Errorf("error when reading %s at %s: %s", |
| 425 | tokenIDToStr(s.t.ID), s.Context(), s.err) |
| 426 | } |
| 427 | |
| 428 | func (s *scanner) appendByte() { |
| 429 | s.t.Value = append(s.t.Value, s.c) |