(stream, state)
| 203 | } |
| 204 | |
| 205 | function tokenString(stream, state) { |
| 206 | while (!stream.eol()) { |
| 207 | stream.eatWhile(/[^'"\{\}\\]/); |
| 208 | if (stream.eat("\\")) { |
| 209 | stream.next(); |
| 210 | if (singleline && stream.eol()) |
| 211 | return OUTCLASS; |
| 212 | } else if (stream.match(delimiter)) { |
| 213 | state.tokenize = tokenOuter; |
| 214 | return OUTCLASS; |
| 215 | } else if (stream.match('{{')) { |
| 216 | // ignore {{ in f-str |
| 217 | return OUTCLASS; |
| 218 | } else if (stream.match('{', false)) { |
| 219 | // switch to nested mode |
| 220 | state.tokenize = tokenNestedExpr(0) |
| 221 | if (stream.current()) return OUTCLASS; |
| 222 | else return state.tokenize(stream, state) |
| 223 | } else if (stream.match('}}')) { |
| 224 | return OUTCLASS; |
| 225 | } else if (stream.match('}')) { |
| 226 | // single } in f-string is an error |
| 227 | return ERRORCLASS; |
| 228 | } else { |
| 229 | stream.eat(/['"]/); |
| 230 | } |
| 231 | } |
| 232 | if (singleline) { |
| 233 | if (parserConf.singleLineStringErrors) |
| 234 | return ERRORCLASS; |
| 235 | else |
| 236 | state.tokenize = tokenOuter; |
| 237 | } |
| 238 | return OUTCLASS; |
| 239 | } |
| 240 | tokenString.isString = true; |
| 241 | return tokenString; |
| 242 | } |
nothing calls this directly
no test coverage detected