scanString consumes a contiguous string of non-quote characters. Quote characters can be consumed if they're first escaped with a backslash.
()
| 205 | // scanString consumes a contiguous string of non-quote characters. |
| 206 | // Quote characters can be consumed if they're first escaped with a backslash. |
| 207 | func (s *Scanner) scanString() (tok Token, pos Pos, lit string) { |
| 208 | s.r.unread() |
| 209 | _, pos = s.r.curr() |
| 210 | |
| 211 | var err error |
| 212 | lit, err = ScanString(s.r) |
| 213 | if err == errBadString { |
| 214 | return BADSTRING, pos, lit |
| 215 | } else if err == errBadEscape { |
| 216 | _, pos = s.r.curr() |
| 217 | return BADESCAPE, pos, lit |
| 218 | } |
| 219 | return STRING, pos, lit |
| 220 | } |
| 221 | |
| 222 | // scanNumber consumes anything that looks like the start of a number. |
| 223 | // Numbers start with a digit, full stop, plus sign or minus sign. |
no test coverage detected