@tbela99/css-parser 2.3.0 → 2.3.2

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.
Files changed (115) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +66 -21
  3. package/architecture.png +0 -0
  4. package/dist/ast/arena-node.js +32 -3
  5. package/dist/ast/arena.js +88 -10
  6. package/dist/ast/cache.js +1 -1
  7. package/dist/ast/features/calc.js +1 -1
  8. package/dist/ast/features/if.js +1 -1
  9. package/dist/ast/features/index.js +1 -1
  10. package/dist/ast/features/inlinecssvariables.js +1 -1
  11. package/dist/ast/features/mixin.js +1 -1
  12. package/dist/ast/features/prefix.js +1 -1
  13. package/dist/ast/features/shorthand.js +1 -1
  14. package/dist/ast/features/transform.js +1 -1
  15. package/dist/ast/features/type.js +1 -1
  16. package/dist/ast/math/expression.js +1 -1
  17. package/dist/ast/math/math.js +1 -1
  18. package/dist/ast/minify.js +131 -36
  19. package/dist/ast/mixins/custom-function.js +1 -1
  20. package/dist/ast/mixins/utils.js +1 -1
  21. package/dist/ast/mixins/variables.js +1 -1
  22. package/dist/ast/strings.js +26 -1
  23. package/dist/ast/transform/compute.js +6 -2
  24. package/dist/ast/transform/matrix.js +1 -1
  25. package/dist/ast/transform/minify.js +1 -1
  26. package/dist/ast/transform/perspective.js +1 -1
  27. package/dist/ast/transform/rotate.js +1 -1
  28. package/dist/ast/transform/scale.js +1 -1
  29. package/dist/ast/transform/skew.js +1 -1
  30. package/dist/ast/transform/translate.js +1 -1
  31. package/dist/ast/transform/utils.js +1 -1
  32. package/dist/ast/types.js +22 -2
  33. package/dist/ast/walk.js +1 -1
  34. package/dist/data/properties.json.js +1 -1
  35. package/dist/data/validation.json.js +1 -1
  36. package/dist/fs/resolve.js +1 -1
  37. package/dist/index-umd-web.js +1099 -295
  38. package/dist/index.d.ts +612 -688
  39. package/dist/node.js +14 -8
  40. package/dist/parser/declaration/list.js +8 -5
  41. package/dist/parser/declaration/map.js +1 -1
  42. package/dist/parser/declaration/set.js +1 -1
  43. package/dist/parser/input.js +62 -4
  44. package/dist/parser/linesmap.js +1 -1
  45. package/dist/parser/parse.js +121 -13
  46. package/dist/parser/source.js +1 -1
  47. package/dist/parser/tokenize.js +161 -19
  48. package/dist/parser/utils/angle.js +1 -1
  49. package/dist/parser/utils/at-rule-container.js +1 -1
  50. package/dist/parser/utils/at-rule-font-feature-values.js +1 -1
  51. package/dist/parser/utils/at-rule-generic.js +1 -1
  52. package/dist/parser/utils/at-rule-import.js +1 -1
  53. package/dist/parser/utils/at-rule-media.js +42 -2
  54. package/dist/parser/utils/at-rule-support.js +1 -1
  55. package/dist/parser/utils/at-rule-when-else.js +1 -1
  56. package/dist/parser/utils/at-rule.js +1 -1
  57. package/dist/parser/utils/base64.js +1 -1
  58. package/dist/parser/utils/cache.js +1 -1
  59. package/dist/parser/utils/canonical.js +1 -1
  60. package/dist/parser/utils/codes.js +1 -1
  61. package/dist/parser/utils/config.js +1 -1
  62. package/dist/parser/utils/declaration.js +1 -1
  63. package/dist/parser/utils/eq.js +1 -1
  64. package/dist/parser/utils/hash.js +1 -1
  65. package/dist/parser/utils/selector.js +98 -6
  66. package/dist/parser/utils/text.js +1 -1
  67. package/dist/parser/utils/token.js +1 -1
  68. package/dist/parser/utils/type.js +1 -1
  69. package/dist/printer/lib/codec.js +1 -1
  70. package/dist/printer/render.js +5 -7
  71. package/dist/printer/result.js +18 -3
  72. package/dist/printer/sourcemap.js +1 -1
  73. package/dist/printer/writer.js +1 -1
  74. package/dist/syntax/color/a98rgb.js +1 -1
  75. package/dist/syntax/color/alpha.js +1 -1
  76. package/dist/syntax/color/cmyk.js +1 -1
  77. package/dist/syntax/color/color-mix.js +1 -1
  78. package/dist/syntax/color/color.js +1 -1
  79. package/dist/syntax/color/hex.js +1 -1
  80. package/dist/syntax/color/hsl.js +12 -4
  81. package/dist/syntax/color/hwb.js +9 -3
  82. package/dist/syntax/color/lab.js +1 -1
  83. package/dist/syntax/color/lch.js +1 -1
  84. package/dist/syntax/color/oklab.js +1 -1
  85. package/dist/syntax/color/oklch.js +2 -2
  86. package/dist/syntax/color/p3.js +1 -1
  87. package/dist/syntax/color/prophotorgb.js +1 -1
  88. package/dist/syntax/color/rec2020.js +1 -1
  89. package/dist/syntax/color/relative-color.js +1 -1
  90. package/dist/syntax/color/rgb.js +1 -1
  91. package/dist/syntax/color/srgb.js +3 -2
  92. package/dist/syntax/color/utils/color-type.js +1 -1
  93. package/dist/syntax/color/utils/colorspace.js +1 -1
  94. package/dist/syntax/color/utils/components.js +1 -1
  95. package/dist/syntax/color/utils/distance.js +1 -1
  96. package/dist/syntax/color/utils/make-color.js +1 -1
  97. package/dist/syntax/color/utils/matrix.js +1 -1
  98. package/dist/syntax/color/xyz.js +1 -1
  99. package/dist/syntax/color/xyzd50.js +1 -1
  100. package/dist/syntax/constants.js +2 -2
  101. package/dist/syntax/syntax.js +1 -1
  102. package/dist/types.js +1 -1
  103. package/dist/utils/sync.js +1 -1
  104. package/dist/validation/compiled/builtins.js +1 -1
  105. package/dist/validation/compiled/runtime.js +1 -1
  106. package/dist/validation/compiled/syntaxes.js +1 -1
  107. package/dist/validation/config.js +1 -1
  108. package/dist/validation/first.js +1 -1
  109. package/dist/validation/match.js +77 -4
  110. package/dist/validation/parser/parse.js +1 -1
  111. package/dist/validation/parser/typedef.js +4 -1
  112. package/dist/validation/utils/list.js +1 -1
  113. package/dist/version.js +2 -2
  114. package/dist/web.js +13 -6
  115. package/package.json +15 -6
package/CHANGELOG.md CHANGED
@@ -1,5 +1,48 @@
1
1
  # Changelog
2
2
 
3
+ # v2.3.2
4
+
5
+ ## Feature
6
+
7
+ - [x] minifier: `mergeRules` option (`MergeRulesEnum`: `All`, `Identical`, `None`; `true` and `false` are shortcuts for `All` and `None`): `MergeRulesEnum.Identical` merges only the adjacent rules that have the same declarations, without computing the size of the output. with `minify: false`, `mergeRules` merges the adjacent rules and at-rules without minifying the ast
8
+ - [x] minifier: `optimizeSelectors` option (`true` by default): `false` does not reduce the selectors or factor them with `:is()` (with `nestingRules: false`)
9
+ - [x] `fastMode` option: `{fastMode: true}` sets `{minify: false, mergeRules: MergeRulesEnum.None}` (the ast is not minified, the rules are not merged), an option given explicitly takes precedence.
10
+
11
+ ## Performance
12
+
13
+ - [x] minifier: two rules that have the same declarations are merged without computing the size of the output
14
+ - [x] minifier: the vendor prefixes of the selectors are compared only when the rules share declarations
15
+ - [x] parser: the selectors made of types, classes, ids, pseudo-classes and pseudo-elements, and the keyframe selectors (`from`, `to`, percentages) are not matched with the selector syntax
16
+ - [x] parser: the whitespace at the start of a statement and before `;`, `{` and `}` is not allocated in the arena
17
+ - [x] parser: the tokens of a statement without errors are recycled without looking for references
18
+ - [x] binary input: the ascii check reads the bytes 4 at a time
19
+ - [x] `ReadableStream` input: the stream is parsed while it is read, chunk by chunk, instead of being read to its end first
20
+ - [x] `ReadableStream` input: the chunks are appended in batches that grow with the css (at least 64 KB, or half of the css read so far): the text is not copied for each chunk
21
+ - [x] `ReadableStream` input: the size of a file loaded with `{file, asStream: true}` (or the content length of an uncompressed response) is recorded by the loader: the code units and the arena are allocated once, like for an ArrayBuffer. 0 means unknown: the buffers grow as the stream is read
22
+ - [x] memory: the last arena used by the selector, validation, minification and transform helpers is no longer referenced by a module variable after the call: it was kept alive until the next parse
23
+
24
+ ## Fix
25
+
26
+ - [x] media queries: `@media not print` and `@media only screen` were dropped
27
+ - [x] gradients: the positions `left top`, `left bottom`, `right bottom` and `X X` (`20% 20%`) were minified into a single value, which is centered vertically (`at left top` became `at 0`, which means `at left center`)
28
+ - [x] colors: `hwb()` with a `var()` component was rendered as `#`
29
+ - [x] colors: the percentages of `rgb()` were not converted to `hsl()` and `hwb()` (`rgb(100% 50% 0%)` was converted to `hsl(30 100% .196078%)`)
30
+ - [x] colors: converting `rgb()` with a `var()` component to `hwb()` threw an error
31
+ - [x] `signal`: an aborted signal did not stop `parse()` / `transform()`
32
+
33
+ ## Types
34
+
35
+ - [x] the bundled type declarations (dist/index.d.ts) type-check without `skipLibCheck`: duplicate exports, missing imports, wrong `EnumToken` members and visitor types fixed
36
+ - [x] TSDoc for every exported symbol (JSR documentation lint)
37
+ - [x] `LOC` and `ValidationTokenEnum` are exported (the keys of the tokens returned by `parseSyntax()`)
38
+ - [x] the visitor maps accept the token type names (`VisitorTokenMap`, `VisitorSyncTokenMap`); `DeclarationVisitorSyncHandler`, `RuleVisitorSyncHandler` and `AtRuleVisitorSyncHandler` added
39
+ - [x] the internal shorthand configuration types (`PropertiesConfig`, `Map`, ...) are no longer exported
40
+
41
+ # v2.3.1
42
+
43
+ - [x] fix deno install
44
+ - [x] document native and wasm builds
45
+
3
46
  # v2.3.0
4
47
 
5
48
  ## Performance
package/README.md CHANGED
@@ -26,6 +26,37 @@ from jsr
26
26
  $ deno add @tbela99/css-parser
27
27
  ```
28
28
 
29
+ ### Native and WebAssembly builds
30
+
31
+ The library is also ported to Rust, in two builds with the same API and the same output as the TypeScript library,
32
+ faster:
33
+
34
+ | Package | Runs in | Speed |
35
+ |---------|---------|-------|
36
+ | [`@tbela99/rust-css-parser-napi`](https://tbela99.github.io/css-parser/docs/documents/Guide.Native_build_%28N-API%29.html) | Node.js on macOS and Linux | up to 2.1x faster than TypeScript |
37
+ | [`@tbela99/rust-css-parser-wasm`](https://tbela99.github.io/css-parser/docs/documents/Guide.WebAssembly_build.html) | Node.js and the browsers | up to 1.9x faster than TypeScript |
38
+
39
+ The WebAssembly build is **only 2.5 MB (865 KB gzipped)**, with no native dependency: it runs anywhere WebAssembly
40
+ runs. The native build is compiled from its Rust sources when it is installed (requires the
41
+ [Rust toolchain](https://rustup.rs)).
42
+
43
+ ```shell
44
+ $ npm install @tbela99/rust-css-parser-wasm
45
+ $ npm install @tbela99/rust-css-parser-napi
46
+ ```
47
+
48
+ Switching build only changes the import:
49
+
50
+ ```javascript
51
+ import {transformSync} from '@tbela99/rust-css-parser-wasm';
52
+
53
+ const result = transformSync('.a { color: #ff0000; width: calc(100px + 20px) }');
54
+ console.debug(result.code); // .a{color:red;width:120px}
55
+ ```
56
+
57
+ It is also available as a Rust library on crates.io: [`rust-css-parser`](https://crates.io/crates/rust-css-parser)
58
+ (`cargo add rust-css-parser`), see [Rust crate](https://tbela99.github.io/css-parser/docs/documents/Guide.Rust_crate.html).
59
+
29
60
  ## Features
30
61
 
31
62
  * **Zero dependencies** — lightweight and easy to integrate into any project.
@@ -49,6 +80,7 @@ $ deno add @tbela99/css-parser
49
80
  * **Binary input** — the css can be a string, an `ArrayBuffer` or an `ArrayBufferView` (utf-8 bytes, `Uint8Array`, `Buffer`): an ASCII buffer is tokenized without copy.
50
81
  * **Experimental**: evaluate @mixin and @function
51
82
  * **51.5kb** once minified and gzipped.
83
+ * **Native and WebAssembly builds** — the same API ported to Rust: an N-API addon for Node.js, and a WebAssembly build of **only 2.5 MB** (865 KB gzipped) for Node.js and the browsers.
52
84
 
53
85
  ## Vendor prefix removal
54
86
  **Vendor prefix cleanup** to modernize generated CSS.
@@ -57,8 +89,8 @@ $ deno add @tbela99/css-parser
57
89
  CSS-Parser can transform these modern CSS features into lower-level CSS syntax:
58
90
  * **Nested CSS transpilation** to legacy-compatible syntax.
59
91
  * **`if()` function transpilation** for broader browser compatibility.
60
- * **CSS mixins and custom functions evaluation** the `@apply` rules are replaced by the mixin body, the custom function calls are replaced by their result.
61
92
  * **`color-mix()` function conversion** convert new color-mix() syntax to any of the supported colors.
93
+ * **CSS mixins and custom functions evaluation** (experimental, enabled with `{evaluateMixins: true}`) the `@apply` rules are replaced by the mixin body, the custom function calls are replaced by their result.
62
94
 
63
95
  ## Benchmark
64
96
 
@@ -72,9 +104,9 @@ A sample result:
72
104
  | ------------------------------ | ------------- | ------------- |
73
105
  | tailwind.css - 2380419 bytes | 1864728 bytes | 1624148 bytes |
74
106
  | bootstrap-4.css - 200078 bytes | 153616 bytes | 144391 bytes |
75
- | bootstrap-5.css - 205481 bytes | 159987 bytes | 150764 bytes |
107
+ | bootstrap-5.css - 205484 bytes | 159987 bytes | 150764 bytes |
76
108
 
77
- On the [complete benchmark suite](https://tbela99.github.io/css-parser/benchmark/index.html), css-parser generated a total output size of 2,158,698 bytes, compared to 2,494,113 bytes for Lightning CSS and larger outputs for all other tested minifiers.
109
+ On the [complete benchmark suite](https://tbela99.github.io/css-parser/benchmark/index.html), css-parser generated a total output size of 2,157,410 bytes, compared to 2,426,883 bytes for Lightning CSS and larger outputs for all other tested minifiers.
78
110
  While some tools prioritize raw execution speed, css-parser focuses on maximizing compression while preserving stylesheet semantics, resulting in consistently smaller production bundles.
79
111
 
80
112
  ## Minification performance vs execution speed
@@ -89,7 +121,7 @@ The parser provides settings that let you choose the balance between minificatio
89
121
 
90
122
  However, the available settings allow you to shift the balance toward execution speed when minimizing runtime is more important than performing every available minification optimization.
91
123
 
92
- The example below demonstrates a balanced configuration that improves execution speed by disabling advanced minification features.
124
+ The example below demonstrates a balanced configuration that improves execution speed by disabling the expensive minification features and keeping the inexpensive ones.
93
125
 
94
126
  ```ts
95
127
 
@@ -97,28 +129,41 @@ import {transformSync} from "@tbela99/css-parser";
97
129
 
98
130
  const css = `...`;
99
131
 
100
- const result = transformSync({
101
- input: css,
102
- minify: false,
103
- beautify: false,
104
- removeEmpty: true,
105
- removeComments: true,
106
- convertColor: true,
107
- minifyValues: true,
108
- });
132
+ // the ast is not minified, the rules are not merged
133
+ const result = transformSync(css, {fastMode: true});
109
134
 
110
135
  console.debug(result.code);
111
136
  console.debug(result.stats);
112
137
  ```
113
138
 
114
- Performance vs execution speed comparison
115
-
116
-
117
- | File: tailwind.css | Speed optimization | Minification optimization |
118
- | --------------------- | ------------------ | ------------------------- |
119
- | Size: 2,380,419 bytes | 1,890,835 bytes | 1,633,188 bytes |
120
- | Time | 109.07 ms | 191.85 ms |
121
- | Size reduction | -20.7% | -31.8% |
139
+ `fastMode: true` sets `minify: false` and `mergeRules: MergeRulesEnum.None`: the ast is not minified, the rules are not
140
+ merged, the values are minified when they are rendered. An option given explicitly takes precedence: `{fastMode: true,
141
+ minify: true}` minifies the ast without merging the rules.
142
+
143
+ Compared with lightningcss and esbuild: the 12 files of the [benchmark](https://tbela99.github.io/css-parser/benchmark/index.html)
144
+ (3.0 MB), total of the median times and of the output sizes (Apple M2, Node.js 27). "fastMode" is the setting of
145
+ the example above, "default settings" are the defaults (the safe minifications). The
146
+ [native](https://tbela99.github.io/css-parser/docs/documents/Guide.Native_build_%28N-API%29.html) and the
147
+ [WebAssembly](https://tbela99.github.io/css-parser/docs/documents/Guide.WebAssembly_build.html) builds produce the
148
+ same output as the TypeScript library, faster.
149
+
150
+ | Library | Time | Output | Output vs lightningcss |
151
+ |---------|-----:|-------:|-----------------------:|
152
+ | N-API, fastMode | 55.8 ms | 2413 KB | +1.8% |
153
+ | lightningcss | 59.2 ms | 2370 KB | |
154
+ | WebAssembly, fastMode | 68.4 ms | 2413 KB | +1.8% |
155
+ | esbuild | 119.8 ms | 2487 KB | +4.9% |
156
+ | N-API, default settings | 124.4 ms | 2107 KB | **-11.1%** |
157
+ | TypeScript, fastMode | 136.1 ms | 2413 KB | +1.8% |
158
+ | WebAssembly, default settings | 142.0 ms | 2107 KB | **-11.1%** |
159
+ | TypeScript, default settings | 243.9 ms | 2107 KB | **-11.1%** |
160
+
161
+ - With the default settings, the output is 11.1% smaller than lightningcss. Lightningcss is about 2.1 times faster
162
+ than the N-API build.
163
+ - With `fastMode`, the N-API build is faster than lightningcss (6% faster), and its output is 1.8% larger. It is
164
+ smaller than the output of esbuild.
165
+
166
+ See [Performance](https://tbela99.github.io/css-parser/docs/documents/Guide.Performance.html) for the details.
122
167
 
123
168
  ## Playground
124
169
 
package/architecture.png CHANGED
Binary file
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.3.0
5
+ Version: 2.3.2
6
6
  License: MIT
7
7
  */
8
8
  import { EnumToken, EnumAstNodeStatus, ColorType } from './types.js';
@@ -128,8 +128,9 @@ class AstArenaNode {
128
128
  */
129
129
  [ARENAID];
130
130
  /**
131
- * @param arena
132
- * @param id
131
+ * create a view of a node of the arena. the view reads and writes the arena: it holds no data
132
+ * @param arena the arena that holds the node
133
+ * @param id the node or token id
133
134
  */
134
135
  constructor(arena, id) {
135
136
  this[ARENA] = arena;
@@ -141,6 +142,9 @@ class AstArenaNode {
141
142
  get typ() {
142
143
  return this[ARENA].dataTypes[this[ARENAID]];
143
144
  }
145
+ /**
146
+ * Set the node or token type
147
+ */
144
148
  set typ(typ) {
145
149
  this[ARENA].dataTypes[this[ARENAID]] = typ;
146
150
  }
@@ -159,6 +163,7 @@ class AstArenaNode {
159
163
  return arena.name[id] === 0 ? undefined : arena.resolveString(arena.name[id]);
160
164
  }
161
165
  /**
166
+ * Set the at-rule / declaration name, token name. undefined for the other nodes
162
167
  *
163
168
  * @param nam
164
169
  */
@@ -177,6 +182,7 @@ class AstArenaNode {
177
182
  : undefined;
178
183
  }
179
184
  /**
185
+ * Set the rule selector. undefined for the other nodes
180
186
  *
181
187
  * @param sel
182
188
  */
@@ -225,6 +231,7 @@ class AstArenaNode {
225
231
  : undefined;
226
232
  }
227
233
  /**
234
+ * Set the value, see the getter: a string, a number, a token or a list of tokens depending on the type of the node
228
235
  *
229
236
  * @param val
230
237
  */
@@ -279,6 +286,8 @@ class AstArenaNode {
279
286
  return listViews(arena, arena.firstToken[id]);
280
287
  }
281
288
  /**
289
+ * Set the children: the child nodes of a stylesheet, a rule or an at-rule with a block, the tokens of a function
290
+ * token (arguments), a parentheses token, ... undefined when the node has no children
282
291
  *
283
292
  * @param chi
284
293
  */
@@ -316,6 +325,7 @@ class AstArenaNode {
316
325
  : listViews(arena, arena.firstToken[id]);
317
326
  }
318
327
  /**
328
+ * Set the prelude tokens of an at-rule, selector tokens of a rule. null when the node has no prelude tokens
319
329
  *
320
330
  * @param tokens
321
331
  */
@@ -334,6 +344,7 @@ class AstArenaNode {
334
344
  : arena.resolveString(arena.unit[id]);
335
345
  }
336
346
  /**
347
+ * Set the unit of a dimension, calendar (`cal`) of a color, attribute (`attr`) of a match expression
337
348
  *
338
349
  * @param unit
339
350
  */
@@ -350,6 +361,9 @@ class AstArenaNode {
350
361
  ? undefined
351
362
  : arena.resolveString(arena.unit[id]);
352
363
  }
364
+ /**
365
+ * Set the color space of a color
366
+ */
353
367
  set cal(cal) {
354
368
  this[ARENA].setUnitString(this[ARENAID], cal ?? null);
355
369
  }
@@ -363,6 +377,9 @@ class AstArenaNode {
363
377
  ? undefined
364
378
  : arena.resolveString(arena.unit[id]);
365
379
  }
380
+ /**
381
+ * Set the attribute of a match expression
382
+ */
366
383
  set attr(attr) {
367
384
  this[ARENA].setUnitString(this[ARENAID], attr ?? null);
368
385
  }
@@ -376,6 +393,9 @@ class AstArenaNode {
376
393
  ? undefined
377
394
  : arena.colorType[id];
378
395
  }
396
+ /**
397
+ * Set the color type of a color token
398
+ */
379
399
  set kin(kin) {
380
400
  this[ARENA].colorType[this[ARENAID]] = kin ?? ColorType.NONE;
381
401
  }
@@ -388,6 +408,7 @@ class AstArenaNode {
388
408
  return arena.dataTypes[id] === EnumToken.UnaryExpressionTokenType ? arena.numericValue[id] : undefined;
389
409
  }
390
410
  /**
411
+ * Set the sign of a unary expression
391
412
  *
392
413
  * @param sign
393
414
  */
@@ -405,6 +426,7 @@ class AstArenaNode {
405
426
  : this.getField("op");
406
427
  }
407
428
  /**
429
+ * Set the operator: the operator of a binary expression, the operator tokens of a structured token
408
430
  *
409
431
  * @param op
410
432
  */
@@ -425,6 +447,7 @@ class AstArenaNode {
425
447
  return this.getField("op1");
426
448
  }
427
449
  /**
450
+ * Set the first operator of a media range query
428
451
  *
429
452
  * @param op
430
453
  */
@@ -438,6 +461,7 @@ class AstArenaNode {
438
461
  return this.getField("op2");
439
462
  }
440
463
  /**
464
+ * Set the second operator of a media range query
441
465
  *
442
466
  * @param op
443
467
  */
@@ -456,6 +480,7 @@ class AstArenaNode {
456
480
  return this.getField("l");
457
481
  }
458
482
  /**
483
+ * Set the left hand side of a structured token, numerator of a fraction
459
484
  *
460
485
  * @param l
461
486
  */
@@ -485,6 +510,7 @@ class AstArenaNode {
485
510
  return this.getField("r");
486
511
  }
487
512
  /**
513
+ * Set the right hand side of a structured token, denominator of a fraction
488
514
  *
489
515
  * @param r
490
516
  */
@@ -511,6 +537,7 @@ class AstArenaNode {
511
537
  return loc == null ? null : Object.freeze(loc);
512
538
  }
513
539
  /**
540
+ * Set the source location. null when the node has no location
514
541
  *
515
542
  * @param loc
516
543
  */
@@ -524,6 +551,7 @@ class AstArenaNode {
524
551
  return this[ARENA].flags[this[ARENAID]] & EnumAstNodeStatus.StateMask;
525
552
  }
526
553
  /**
554
+ * Set the validation state
527
555
  *
528
556
  * @param state
529
557
  */
@@ -539,6 +567,7 @@ class AstArenaNode {
539
567
  return errors == null ? null : Object.freeze(errors.slice());
540
568
  }
541
569
  /**
570
+ * Set the validation errors. null when the node has no errors
542
571
  *
543
572
  * @param errors
544
573
  */