@lezer/css 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 1.2.1 (2025-05-15)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix parsing of `*` selectors in descendant positions.
6
+
1
7
  ## 1.2.0 (2025-05-12)
2
8
 
3
9
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -19,7 +19,7 @@ const descendantOp = 107,
19
19
  const space = [9, 10, 11, 12, 13, 32, 133, 160, 5760, 8192, 8193, 8194, 8195, 8196, 8197,
20
20
  8198, 8199, 8200, 8201, 8202, 8232, 8233, 8239, 8287, 12288];
21
21
  const colon = 58, parenL = 40, underscore = 95, bracketL = 91, dash = 45, period = 46,
22
- hash = 35, percent = 37, ampersand = 38, backslash = 92, newline = 10;
22
+ hash = 35, percent = 37, ampersand = 38, backslash = 92, newline = 10, asterisk = 42;
23
23
 
24
24
  function isAlpha(ch) { return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 161 }
25
25
 
@@ -51,7 +51,7 @@ const descendant = new lr.ExternalTokenizer(input => {
51
51
  if (space.includes(input.peek(-1))) {
52
52
  let {next} = input;
53
53
  if (isAlpha(next) || next == underscore || next == hash || next == period ||
54
- next == bracketL || next == colon && isAlpha(input.peek(1)) ||
54
+ next == asterisk || next == bracketL || next == colon && isAlpha(input.peek(1)) ||
55
55
  next == dash || next == ampersand)
56
56
  input.acceptToken(descendantOp);
57
57
  }
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ const descendantOp = 107,
15
15
  const space = [9, 10, 11, 12, 13, 32, 133, 160, 5760, 8192, 8193, 8194, 8195, 8196, 8197,
16
16
  8198, 8199, 8200, 8201, 8202, 8232, 8233, 8239, 8287, 12288];
17
17
  const colon = 58, parenL = 40, underscore = 95, bracketL = 91, dash = 45, period = 46,
18
- hash = 35, percent = 37, ampersand = 38, backslash = 92, newline = 10;
18
+ hash = 35, percent = 37, ampersand = 38, backslash = 92, newline = 10, asterisk = 42;
19
19
 
20
20
  function isAlpha(ch) { return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 161 }
21
21
 
@@ -47,7 +47,7 @@ const descendant = new ExternalTokenizer(input => {
47
47
  if (space.includes(input.peek(-1))) {
48
48
  let {next} = input;
49
49
  if (isAlpha(next) || next == underscore || next == hash || next == period ||
50
- next == bracketL || next == colon && isAlpha(input.peek(1)) ||
50
+ next == asterisk || next == bracketL || next == colon && isAlpha(input.peek(1)) ||
51
51
  next == dash || next == ampersand)
52
52
  input.acceptToken(descendantOp);
53
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lezer/css",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "lezer-based CSS grammar",
5
5
  "main": "dist/index.cjs",
6
6
  "type": "module",
package/src/tokens.js CHANGED
@@ -7,7 +7,7 @@ import {callee, identifier, VariableName, queryIdentifier, descendantOp, Unit} f
7
7
  const space = [9, 10, 11, 12, 13, 32, 133, 160, 5760, 8192, 8193, 8194, 8195, 8196, 8197,
8
8
  8198, 8199, 8200, 8201, 8202, 8232, 8233, 8239, 8287, 12288]
9
9
  const colon = 58, parenL = 40, underscore = 95, bracketL = 91, dash = 45, period = 46,
10
- hash = 35, percent = 37, ampersand = 38, backslash = 92, newline = 10
10
+ hash = 35, percent = 37, ampersand = 38, backslash = 92, newline = 10, asterisk = 42
11
11
 
12
12
  function isAlpha(ch) { return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 161 }
13
13
 
@@ -39,7 +39,7 @@ export const descendant = new ExternalTokenizer(input => {
39
39
  if (space.includes(input.peek(-1))) {
40
40
  let {next} = input
41
41
  if (isAlpha(next) || next == underscore || next == hash || next == period ||
42
- next == bracketL || next == colon && isAlpha(input.peek(1)) ||
42
+ next == asterisk || next == bracketL || next == colon && isAlpha(input.peek(1)) ||
43
43
  next == dash || next == ampersand)
44
44
  input.acceptToken(descendantOp)
45
45
  }
package/test/selector.txt CHANGED
@@ -1,10 +1,13 @@
1
1
  # Universal selectors
2
2
 
3
3
  * {}
4
+ div * {}
4
5
 
5
6
  ==>
6
7
 
7
- StyleSheet(RuleSet(UniversalSelector,Block))
8
+ StyleSheet(
9
+ RuleSet(UniversalSelector,Block),
10
+ RuleSet(DescendantSelector(TagSelector(TagName),UniversalSelector),Block))
8
11
 
9
12
  # Type selectors
10
13