(comment bool, sep int)
| 165 | } |
| 166 | |
| 167 | func (s *scanner) readMultiLine(comment bool, sep int) (str string) { |
| 168 | if s.saveAndAdvance(); isNewLine(s.current) { |
| 169 | s.incrementLineNumber() |
| 170 | } |
| 171 | for { |
| 172 | switch s.current { |
| 173 | case endOfStream: |
| 174 | if comment { |
| 175 | s.scanError("unfinished long comment", tkEOS) |
| 176 | } else { |
| 177 | s.scanError("unfinished long string", tkEOS) |
| 178 | } |
| 179 | case ']': |
| 180 | if s.skipSeparator() == sep { |
| 181 | s.saveAndAdvance() |
| 182 | if !comment { |
| 183 | str = s.buffer.String() |
| 184 | str = str[2+sep : len(str)-(2+sep)] |
| 185 | } |
| 186 | s.buffer.Reset() |
| 187 | return |
| 188 | } |
| 189 | case '\r': |
| 190 | s.current = '\n' |
| 191 | fallthrough |
| 192 | case '\n': |
| 193 | s.save(s.current) |
| 194 | s.incrementLineNumber() |
| 195 | default: |
| 196 | if !comment { |
| 197 | s.save(s.current) |
| 198 | } |
| 199 | s.advance() |
| 200 | } |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | func (s *scanner) readDigits() (c rune) { |
| 205 | for c = s.current; isDecimal(c); c = s.current { |
no test coverage detected