()
| 330 | } |
| 331 | |
| 332 | private consumeToken(): CSSToken { |
| 333 | const codePoint = this.consumeCodePoint(); |
| 334 | |
| 335 | switch (codePoint) { |
| 336 | case QUOTATION_MARK: |
| 337 | return this.consumeStringToken(QUOTATION_MARK); |
| 338 | case NUMBER_SIGN: |
| 339 | const c1 = this.peekCodePoint(0); |
| 340 | const c2 = this.peekCodePoint(1); |
| 341 | const c3 = this.peekCodePoint(2); |
| 342 | if (isNameCodePoint(c1) || isValidEscape(c2, c3)) { |
| 343 | const flags = isIdentifierStart(c1, c2, c3) ? FLAG_ID : FLAG_UNRESTRICTED; |
| 344 | const value = this.consumeName(); |
| 345 | |
| 346 | return {type: TokenType.HASH_TOKEN, value, flags}; |
| 347 | } |
| 348 | break; |
| 349 | case DOLLAR_SIGN: |
| 350 | if (this.peekCodePoint(0) === EQUALS_SIGN) { |
| 351 | this.consumeCodePoint(); |
| 352 | return SUFFIX_MATCH_TOKEN; |
| 353 | } |
| 354 | break; |
| 355 | case APOSTROPHE: |
| 356 | return this.consumeStringToken(APOSTROPHE); |
| 357 | case LEFT_PARENTHESIS: |
| 358 | return LEFT_PARENTHESIS_TOKEN; |
| 359 | case RIGHT_PARENTHESIS: |
| 360 | return RIGHT_PARENTHESIS_TOKEN; |
| 361 | case ASTERISK: |
| 362 | if (this.peekCodePoint(0) === EQUALS_SIGN) { |
| 363 | this.consumeCodePoint(); |
| 364 | return SUBSTRING_MATCH_TOKEN; |
| 365 | } |
| 366 | break; |
| 367 | case PLUS_SIGN: |
| 368 | if (isNumberStart(codePoint, this.peekCodePoint(0), this.peekCodePoint(1))) { |
| 369 | this.reconsumeCodePoint(codePoint); |
| 370 | return this.consumeNumericToken(); |
| 371 | } |
| 372 | break; |
| 373 | case COMMA: |
| 374 | return COMMA_TOKEN; |
| 375 | case HYPHEN_MINUS: |
| 376 | const e1 = codePoint; |
| 377 | const e2 = this.peekCodePoint(0); |
| 378 | const e3 = this.peekCodePoint(1); |
| 379 | |
| 380 | if (isNumberStart(e1, e2, e3)) { |
| 381 | this.reconsumeCodePoint(codePoint); |
| 382 | return this.consumeNumericToken(); |
| 383 | } |
| 384 | |
| 385 | if (isIdentifierStart(e1, e2, e3)) { |
| 386 | this.reconsumeCodePoint(codePoint); |
| 387 | return this.consumeIdentLikeToken(); |
| 388 | } |
| 389 |
no test coverage detected