| 164 | } |
| 165 | |
| 166 | function tokenFactory(delimiter, outclass) { |
| 167 | var singleline = delimiter.length == 1; |
| 168 | return function tokenString(stream, state) { |
| 169 | while (!stream.eol()) { |
| 170 | stream.eatWhile(/[^'"\/\\]/); |
| 171 | if (stream.eat('\\')) { |
| 172 | stream.next(); |
| 173 | if (singleline && stream.eol()) { |
| 174 | return outclass; |
| 175 | } |
| 176 | } else if (stream.match(delimiter)) { |
| 177 | state.tokenize = tokenBase; |
| 178 | return outclass; |
| 179 | } else { |
| 180 | stream.eat(/['"\/]/); |
| 181 | } |
| 182 | } |
| 183 | if (singleline) { |
| 184 | if (conf.mode.singleLineStringErrors) { |
| 185 | outclass = ERRORCLASS |
| 186 | } else { |
| 187 | state.tokenize = tokenBase; |
| 188 | } |
| 189 | } |
| 190 | return outclass; |
| 191 | }; |
| 192 | } |
| 193 | |
| 194 | function longComment(stream, state) { |
| 195 | while (!stream.eol()) { |