* 4.3.4. Consume a string token * https://www.w3.org/TR/css-syntax-3/#consume-a-string-token
()
| 339 | * https://www.w3.org/TR/css-syntax-3/#consume-a-string-token |
| 340 | */ |
| 341 | private consumeAStringToken(): InputTokenObject { |
| 342 | const char = this.text[this.nextInputCodePointIndex]; |
| 343 | let result: RegExpExecArray; |
| 344 | if (char === "'") { |
| 345 | singleQuoteStringRegEx.lastIndex = this.nextInputCodePointIndex; |
| 346 | result = singleQuoteStringRegEx.exec(this.text); |
| 347 | if (!result) { |
| 348 | return null; |
| 349 | } |
| 350 | this.nextInputCodePointIndex = singleQuoteStringRegEx.lastIndex; |
| 351 | } else if (char === '"') { |
| 352 | doubleQuoteStringRegEx.lastIndex = this.nextInputCodePointIndex; |
| 353 | result = doubleQuoteStringRegEx.exec(this.text); |
| 354 | if (!result) { |
| 355 | return null; |
| 356 | } |
| 357 | this.nextInputCodePointIndex = doubleQuoteStringRegEx.lastIndex; |
| 358 | } |
| 359 | |
| 360 | // TODO: Handle bad-string. |
| 361 | // TODO: Perform string escaping. |
| 362 | return { type: TokenObjectType.string, text: result[0] }; |
| 363 | } |
| 364 | |
| 365 | /** |
| 366 | * 4.3.5. Consume a url token |
no outgoing calls
no test coverage detected