Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/css-tokenizer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

### Unreleased (patch)

- Fix handling of astral code points in `string-token` and `url-token` values.
- Fix decoding of astral code points in `string-token` and `url-token` values.
- Improve performance

### 4.0.0

Expand Down
2 changes: 1 addition & 1 deletion packages/css-tokenizer/dist/index.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/css-tokenizer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"dist"
],
"devDependencies": {
"@rmenke/css-tokenizer-tests": "^1.3.1",
"@rmenke/css-tokenizer-tests": "^1.4.0",
"postcss": "^8.5.10",
"postcss-parser-tests": "^8.10.0"
},
Expand Down

This file was deleted.

19 changes: 0 additions & 19 deletions packages/css-tokenizer/src/checks/matches-url-ident.ts

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions packages/css-tokenizer/src/checks/two-code-points-start-comment.ts

This file was deleted.

44 changes: 23 additions & 21 deletions packages/css-tokenizer/src/code-points/ranges.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
import { BACKSPACE, DELETE, INFORMATION_SEPARATOR_ONE, LINE_TABULATION, LOW_LINE, HYPHEN_MINUS, NULL, SHIFT_OUT, LINE_FEED, CARRIAGE_RETURN, FORM_FEED, SPACE, CHARACTER_TABULATION } from './code-points';
import { BACKSPACE, CARRIAGE_RETURN, CHARACTER_TABULATION, DELETE, FORM_FEED, HYPHEN_MINUS, INFORMATION_SEPARATOR_ONE, LINE_FEED, LINE_TABULATION, LOW_LINE, NULL, SHIFT_OUT, SPACE } from './code-points';
// https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#tokenizer-definitions

// https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#digit
export function isDigitCodePoint(search: number): boolean {
return search >= 0x0030 && search <= 0x0039;
}

// https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#uppercase-letter
function isUppercaseLetterCodePoint(search: number): boolean {
return search >= 0x0041 && search <= 0x005a;
}

// https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#lowercase-letter
function isLowercaseLetterCodePoint(search: number): boolean {
return search >= 0x0061 && search <= 0x007a;
}

// https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#hex-digit
export function isHexDigitCodePoint(search: number): boolean {
return (
Expand All @@ -25,23 +15,35 @@ export function isHexDigitCodePoint(search: number): boolean {
);
}

// https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#letter
function isLetterCodePoint(search: number): boolean {
return isLowercaseLetterCodePoint(search) || isUppercaseLetterCodePoint(search);
}

// https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#ident-start-code-point
export function isIdentStartCodePoint(search: number): boolean {
return isLetterCodePoint(search) || isNonASCII_IdentCodePoint(search) || search === LOW_LINE;
return (
(search >= 0x0061 && search <= 0x007a) || // a .. z
(search >= 0x0041 && search <= 0x005a) || // A .. Z
search === LOW_LINE ||
isNonASCII_IdentCodePoint(search)
);
}

// https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#ident-code-point
export function isIdentCodePoint(search: number): boolean {
return isIdentStartCodePoint(search) || isDigitCodePoint(search) || search === HYPHEN_MINUS;
return (
(search >= 0x0061 && search <= 0x007a) || // a .. z
(search >= 0x0041 && search <= 0x005a) || // A .. Z
(search >= 0x0030 && search <= 0x0039) || // 0 .. 9
search === HYPHEN_MINUS ||
search === LOW_LINE ||
isNonASCII_IdentCodePoint(search)
);
}

// https://drafts.csswg.org/css-syntax/#non-ascii-ident-code-point
function isNonASCII_IdentCodePoint(search: number): boolean {
export function isNonASCII_IdentCodePoint(search: number): boolean {
// The only code points below U+00B7 that are non-ASCII ident code points is U+0000 NULL.
if (search < 0x00B7) {
return search === NULL;
}

if (
search === 0x00B7 ||
search === 0x200C ||
Expand All @@ -68,9 +70,9 @@ function isNonASCII_IdentCodePoint(search: number): boolean {
}

// Input preprocessing
if (search === 0x000) {
if (search === NULL) {
return true;
} else if (isSurrogate(search)) {
} else if (search >= 0xd800 && search <= 0xdfff) { // surrogate
return true;
}

Expand Down
29 changes: 0 additions & 29 deletions packages/css-tokenizer/src/consume/bad-url.ts

This file was deleted.

58 changes: 0 additions & 58 deletions packages/css-tokenizer/src/consume/comment.ts

This file was deleted.

Loading
Loading