@thi.ng/parse 2.6.38 → 2.6.40
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/README.md +2 -2
- package/grammar.js +5 -5
- package/package.json +7 -7
- package/xform/join.js +1 -1
- package/xform/print.js +1 -1
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 212 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
|
@@ -103,7 +103,7 @@ For Node.js REPL:
|
|
|
103
103
|
const parse = await import("@thi.ng/parse");
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 5.
|
|
106
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 5.43 KB
|
|
107
107
|
|
|
108
108
|
## Dependencies
|
|
109
109
|
|
package/grammar.js
CHANGED
|
@@ -124,7 +124,7 @@ const __nth = ($, n) => $.children[n];
|
|
|
124
124
|
const __hasDynRuleRefs = (term, builtins) => {
|
|
125
125
|
let res = term.id === "ref" && !builtins.has(__first(term).result);
|
|
126
126
|
if (term.children) {
|
|
127
|
-
for (
|
|
127
|
+
for (const x of term.children) {
|
|
128
128
|
res ||= __hasDynRuleRefs(x, builtins);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
@@ -142,7 +142,7 @@ const __compile = defmulti(
|
|
|
142
142
|
const builtins = new Set(Object.keys(lang.rules));
|
|
143
143
|
const staticRules = /* @__PURE__ */ new Set();
|
|
144
144
|
const dynamicRules = /* @__PURE__ */ new Set();
|
|
145
|
-
for (
|
|
145
|
+
for (const r of rules) {
|
|
146
146
|
if (__hasDynRuleRefs(r, builtins)) {
|
|
147
147
|
lang.rules[__first(r).result] = dynamic();
|
|
148
148
|
dynamicRules.add(r);
|
|
@@ -150,7 +150,7 @@ const __compile = defmulti(
|
|
|
150
150
|
staticRules.add(r);
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
for (
|
|
153
|
+
for (const r of [...staticRules, ...dynamicRules]) {
|
|
154
154
|
const id = __first(r).result;
|
|
155
155
|
const parser = __compile(r, lang, opts, flags);
|
|
156
156
|
if (dynamicRules.has(r)) {
|
|
@@ -165,7 +165,7 @@ const __compile = defmulti(
|
|
|
165
165
|
const [id, body, xf] = $.children;
|
|
166
166
|
opts.debug && console.log(`rule: ${id.result}`, xf);
|
|
167
167
|
const acc = [];
|
|
168
|
-
for (
|
|
168
|
+
for (const b of body.children) {
|
|
169
169
|
const c = __compile(b, lang, opts, flags);
|
|
170
170
|
c && acc.push(c);
|
|
171
171
|
}
|
|
@@ -218,7 +218,7 @@ const __compile = defmulti(
|
|
|
218
218
|
const [term0, { children: terms }, repeat2, disc, lookahead2] = $.children;
|
|
219
219
|
const acc = [__compile(term0, lang, opts, flags)];
|
|
220
220
|
if (terms) {
|
|
221
|
-
for (
|
|
221
|
+
for (const c of terms) {
|
|
222
222
|
acc.push(__compile(__first(c), lang, opts, flags));
|
|
223
223
|
}
|
|
224
224
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/parse",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.40",
|
|
4
4
|
"description": "Purely functional parser combinators & AST generation for generic inputs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@thi.ng/api": "^8.12.
|
|
43
|
-
"@thi.ng/checks": "^3.
|
|
44
|
-
"@thi.ng/defmulti": "^3.0.
|
|
45
|
-
"@thi.ng/errors": "^2.
|
|
46
|
-
"@thi.ng/strings": "^3.9.
|
|
42
|
+
"@thi.ng/api": "^8.12.11",
|
|
43
|
+
"@thi.ng/checks": "^3.8.1",
|
|
44
|
+
"@thi.ng/defmulti": "^3.0.87",
|
|
45
|
+
"@thi.ng/errors": "^2.6.0",
|
|
46
|
+
"@thi.ng/strings": "^3.9.32"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"esbuild": "^0.27.0",
|
|
@@ -246,5 +246,5 @@
|
|
|
246
246
|
],
|
|
247
247
|
"year": 2020
|
|
248
248
|
},
|
|
249
|
-
"gitHead": "
|
|
249
|
+
"gitHead": "e7a21b9d2a188fa04d4c893d8531c40fbc0f4c06\n"
|
|
250
250
|
}
|
package/xform/join.js
CHANGED
package/xform/print.js
CHANGED
|
@@ -8,7 +8,7 @@ const xfPrint = (fn = console.log) => {
|
|
|
8
8
|
const info = state ? ` (${state.l}:${state.c})` : "";
|
|
9
9
|
fn(`${prefix}${scope.id}${info}: ${JSON.stringify(scope.result)}`);
|
|
10
10
|
if (scope.children) {
|
|
11
|
-
for (
|
|
11
|
+
for (const c of scope.children) {
|
|
12
12
|
$print(c, _, level + 1);
|
|
13
13
|
}
|
|
14
14
|
}
|