(quote, f)
| 250 | // tokenizer for string literals |
| 251 | // optionally pass a tokenizer function to set state.tokenize back to when finished |
| 252 | function tokenString(quote, f) { |
| 253 | return function(stream, state) { |
| 254 | var ch; |
| 255 | |
| 256 | if(isInString(state) && stream.current() == quote) { |
| 257 | popStateStack(state); |
| 258 | if(f) state.tokenize = f; |
| 259 | return ret("string", "string"); |
| 260 | } |
| 261 | |
| 262 | pushStateStack(state, { type: "string", name: quote, tokenize: tokenString(quote, f) }); |
| 263 | |
| 264 | // if we're in a string and in an XML block, allow an embedded code block |
| 265 | if(stream.match("{", false) && isInXmlAttributeBlock(state)) { |
| 266 | state.tokenize = tokenBase; |
| 267 | return ret("string", "string"); |
| 268 | } |
| 269 | |
| 270 | |
| 271 | while (ch = stream.next()) { |
| 272 | if (ch == quote) { |
| 273 | popStateStack(state); |
| 274 | if(f) state.tokenize = f; |
| 275 | break; |
| 276 | } |
| 277 | else { |
| 278 | // if we're in a string and in an XML block, allow an embedded code block in an attribute |
| 279 | if(stream.match("{", false) && isInXmlAttributeBlock(state)) { |
| 280 | state.tokenize = tokenBase; |
| 281 | return ret("string", "string"); |
| 282 | } |
| 283 | |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | return ret("string", "string"); |
| 288 | }; |
| 289 | } |
| 290 | |
| 291 | // tokenizer for variables |
| 292 | function tokenVariable(stream, state) { |
no test coverage detected