@thi.ng/parse 1.0.4 → 2.0.3

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 (101) hide show
  1. package/CHANGELOG.md +85 -137
  2. package/README.md +15 -6
  3. package/api.d.ts +1 -1
  4. package/combinators/alt.d.ts +1 -1
  5. package/combinators/alt.js +1 -1
  6. package/combinators/boundary.d.ts +1 -1
  7. package/combinators/boundary.js +2 -2
  8. package/combinators/check.d.ts +1 -1
  9. package/combinators/check.js +2 -2
  10. package/combinators/dynamic.d.ts +1 -1
  11. package/combinators/expect.d.ts +1 -1
  12. package/combinators/expect.js +1 -1
  13. package/combinators/lookahead.d.ts +1 -1
  14. package/combinators/lookahead.js +1 -1
  15. package/combinators/maybe.d.ts +1 -1
  16. package/combinators/maybe.js +1 -1
  17. package/combinators/not.d.ts +1 -1
  18. package/combinators/not.js +1 -1
  19. package/combinators/repeat.d.ts +1 -1
  20. package/combinators/repeat.js +1 -1
  21. package/combinators/seq.d.ts +1 -1
  22. package/combinators/seq.js +1 -1
  23. package/combinators/wrap.d.ts +1 -1
  24. package/combinators/wrap.js +3 -3
  25. package/combinators/xform.d.ts +1 -1
  26. package/context.d.ts +1 -1
  27. package/context.js +8 -7
  28. package/error.d.ts +1 -1
  29. package/error.js +1 -1
  30. package/grammar.d.ts +1 -1
  31. package/grammar.js +65 -48
  32. package/index.d.ts +49 -49
  33. package/index.js +49 -49
  34. package/package.json +183 -31
  35. package/presets/alpha.d.ts +4 -4
  36. package/presets/alpha.js +3 -3
  37. package/presets/bits.d.ts +2 -2
  38. package/presets/bits.js +4 -4
  39. package/presets/digits.d.ts +2 -2
  40. package/presets/digits.js +2 -2
  41. package/presets/escape.d.ts +2 -2
  42. package/presets/escape.js +9 -9
  43. package/presets/hex.d.ts +3 -3
  44. package/presets/hex.js +5 -5
  45. package/presets/numbers.d.ts +5 -5
  46. package/presets/numbers.js +12 -12
  47. package/presets/string.d.ts +1 -1
  48. package/presets/string.js +7 -7
  49. package/presets/whitespace.d.ts +8 -8
  50. package/presets/whitespace.js +3 -3
  51. package/prims/always.d.ts +2 -2
  52. package/prims/always.js +1 -1
  53. package/prims/anchor.d.ts +1 -1
  54. package/prims/anchor.js +1 -1
  55. package/prims/fail.d.ts +1 -1
  56. package/prims/fail.js +1 -1
  57. package/prims/lit.d.ts +2 -2
  58. package/prims/lit.js +1 -1
  59. package/prims/none-of.d.ts +1 -1
  60. package/prims/none-of.js +3 -2
  61. package/prims/one-of.d.ts +1 -1
  62. package/prims/one-of.js +3 -2
  63. package/prims/pass.d.ts +1 -1
  64. package/prims/pass.js +1 -1
  65. package/prims/range.d.ts +1 -1
  66. package/prims/range.js +1 -1
  67. package/prims/satisfy.d.ts +1 -1
  68. package/prims/skip.d.ts +1 -1
  69. package/prims/skip.js +1 -1
  70. package/prims/string.d.ts +1 -1
  71. package/prims/string.js +2 -2
  72. package/readers/array-reader.d.ts +1 -1
  73. package/readers/string-reader.d.ts +1 -1
  74. package/utils.js +1 -0
  75. package/xform/collect.d.ts +1 -1
  76. package/xform/collect.js +1 -1
  77. package/xform/comp.d.ts +1 -1
  78. package/xform/count.d.ts +1 -1
  79. package/xform/count.js +1 -1
  80. package/xform/discard.d.ts +1 -1
  81. package/xform/discard.js +1 -1
  82. package/xform/hoist.d.ts +1 -1
  83. package/xform/hoist.js +1 -1
  84. package/xform/join.d.ts +1 -1
  85. package/xform/join.js +1 -1
  86. package/xform/nest.d.ts +1 -1
  87. package/xform/nest.js +4 -4
  88. package/xform/number.d.ts +1 -1
  89. package/xform/number.js +1 -1
  90. package/xform/print.d.ts +1 -1
  91. package/xform/print.js +2 -2
  92. package/xform/replace.d.ts +1 -1
  93. package/xform/replace.js +1 -1
  94. package/xform/trim.d.ts +1 -1
  95. package/xform/trim.js +1 -1
  96. package/xform/with-id.d.ts +1 -1
  97. package/xform/with-id.js +1 -1
  98. package/lib/index.js +0 -967
  99. package/lib/index.js.map +0 -1
  100. package/lib/index.umd.js +0 -1
  101. package/lib/index.umd.js.map +0 -1
package/grammar.js CHANGED
@@ -1,40 +1,41 @@
1
- import { DEFAULT, defmulti } from "@thi.ng/defmulti";
2
- import { illegalArgs, unsupported } from "@thi.ng/errors";
3
- import { alt, altD } from "./combinators/alt";
4
- import { dynamic } from "./combinators/dynamic";
5
- import { lookahead } from "./combinators/lookahead";
6
- import { maybe } from "./combinators/maybe";
7
- import { not } from "./combinators/not";
8
- import { oneOrMore, repeat, zeroOrMore } from "./combinators/repeat";
9
- import { seq, seqD } from "./combinators/seq";
10
- import { xform } from "./combinators/xform";
11
- import { defContext } from "./context";
12
- import { ALPHA, ALPHA_NUM } from "./presets/alpha";
13
- import { BIT } from "./presets/bits";
14
- import { DIGIT } from "./presets/digits";
15
- import { ESC, UNICODE } from "./presets/escape";
16
- import { HEX_DIGIT } from "./presets/hex";
17
- import { FLOAT, INT, UINT } from "./presets/numbers";
18
- import { STRING } from "./presets/string";
19
- import { DNL, NL, WS, WS0, WS1 } from "./presets/whitespace";
20
- import { always, alwaysD } from "./prims/always";
21
- import { inputEnd, inputStart, lineEnd, lineStart, wordBoundary, } from "./prims/anchor";
22
- import { lit, litD } from "./prims/lit";
23
- import { noneOf } from "./prims/none-of";
24
- import { oneOf } from "./prims/one-of";
25
- import { range, rangeD } from "./prims/range";
26
- import { string, stringD } from "./prims/string";
27
- import { collect, xfCollect } from "./xform/collect";
28
- import { xfCount } from "./xform/count";
29
- import { discard, xfDiscard } from "./xform/discard";
30
- import { hoist, hoistResult, xfHoist, xfHoistResult } from "./xform/hoist";
31
- import { join, xfJoin } from "./xform/join";
32
- import { nest } from "./xform/nest";
33
- import { xfFloat, xfInt } from "./xform/number";
34
- import { print, xfPrint } from "./xform/print";
35
- import { xfReplace } from "./xform/replace";
36
- import { xfTrim } from "./xform/trim";
37
- import { withID } from "./xform/with-id";
1
+ import { DEFAULT, defmulti } from "@thi.ng/defmulti/defmulti";
2
+ import { illegalArgs } from "@thi.ng/errors/illegal-arguments";
3
+ import { unsupported } from "@thi.ng/errors/unsupported";
4
+ import { alt, altD } from "./combinators/alt.js";
5
+ import { dynamic } from "./combinators/dynamic.js";
6
+ import { lookahead } from "./combinators/lookahead.js";
7
+ import { maybe } from "./combinators/maybe.js";
8
+ import { not } from "./combinators/not.js";
9
+ import { oneOrMore, repeat, zeroOrMore } from "./combinators/repeat.js";
10
+ import { seq, seqD } from "./combinators/seq.js";
11
+ import { xform } from "./combinators/xform.js";
12
+ import { defContext } from "./context.js";
13
+ import { ALPHA, ALPHA_NUM } from "./presets/alpha.js";
14
+ import { BIT } from "./presets/bits.js";
15
+ import { DIGIT } from "./presets/digits.js";
16
+ import { ESC, UNICODE } from "./presets/escape.js";
17
+ import { HEX_DIGIT } from "./presets/hex.js";
18
+ import { FLOAT, INT, UINT } from "./presets/numbers.js";
19
+ import { STRING } from "./presets/string.js";
20
+ import { DNL, NL, WS, WS0, WS1 } from "./presets/whitespace.js";
21
+ import { always, alwaysD } from "./prims/always.js";
22
+ import { inputEnd, inputStart, lineEnd, lineStart, wordBoundary, } from "./prims/anchor.js";
23
+ import { lit, litD } from "./prims/lit.js";
24
+ import { noneOf } from "./prims/none-of.js";
25
+ import { oneOf } from "./prims/one-of.js";
26
+ import { range, rangeD } from "./prims/range.js";
27
+ import { string, stringD } from "./prims/string.js";
28
+ import { collect, xfCollect } from "./xform/collect.js";
29
+ import { xfCount } from "./xform/count.js";
30
+ import { discard, xfDiscard } from "./xform/discard.js";
31
+ import { hoist, hoistResult, xfHoist, xfHoistResult } from "./xform/hoist.js";
32
+ import { join, xfJoin } from "./xform/join.js";
33
+ import { nest } from "./xform/nest.js";
34
+ import { xfFloat, xfInt } from "./xform/number.js";
35
+ import { print, xfPrint } from "./xform/print.js";
36
+ import { xfReplace } from "./xform/replace.js";
37
+ import { xfTrim } from "./xform/trim.js";
38
+ import { withID } from "./xform/with-id.js";
38
39
  const apos = litD("'");
39
40
  const dash = litD("-");
40
41
  const REPEAT = maybe(alt([
@@ -89,9 +90,9 @@ export const GRAMMAR = zeroOrMore(alt([RULE, COMMENT]), "rules");
89
90
  const first = ($) => $.children[0];
90
91
  const nth = ($, n) => $.children[n];
91
92
  const compile = defmulti((scope) => scope.id, {
92
- unicode: ["char"],
93
- });
94
- compile.addAll({
93
+ unicode: "char",
94
+ }, {
95
+ [DEFAULT]: ($) => unsupported(`unknown op: ${$.id}`),
95
96
  root: ($, lang, opts, flags) => {
96
97
  const rules = first($).children;
97
98
  rules.reduce((acc, r) => ((acc[first(r).result] = dynamic()), acc), lang.rules);
@@ -109,7 +110,9 @@ compile.addAll({
109
110
  const c = compile(b, lang, opts, flags);
110
111
  c && acc.push(c);
111
112
  }
112
- let parser = acc.length > 1 ? seq(acc, id.result) : withID(id.result, acc[0]);
113
+ let parser = acc.length > 1
114
+ ? seq(acc, id.result)
115
+ : withID(id.result, acc[0]);
113
116
  if (xf.id === "sym") {
114
117
  const $xf = lang.env[xf.result];
115
118
  if (!$xf)
@@ -143,16 +146,16 @@ compile.addAll({
143
146
  term: ($, lang, opts, flags) => {
144
147
  const [term, repeat, discard, lookahead] = $.children;
145
148
  opts.debug && console.log(`term: ${term.id}`, flags);
146
- return compileRDL((discard) => compile(term, lang, opts, Object.assign(Object.assign({}, flags), { discard })), repeat, discard, lookahead, lang, opts);
149
+ return compileRDL((discard) => compile(term, lang, opts, { ...flags, discard }), repeat, discard, lookahead, lang, opts);
147
150
  },
148
151
  lhterm: ($, lang, opts, flags) => {
149
152
  const [term, repeat, discard] = $.children;
150
153
  opts.debug && console.log(`lhterm: ${term.id}`);
151
- return compileRD((discard) => compile(term, lang, opts, Object.assign(Object.assign({}, flags), { discard })), repeat, discard, opts);
154
+ return compileRD((discard) => compile(term, lang, opts, { ...flags, discard }), repeat, discard, opts);
152
155
  },
153
156
  alt: ($, lang, opts, flags) => {
154
157
  opts.debug && console.log(`alt: ${$.id}`, flags);
155
- const [term0, { children: terms }, repeat, disc, lookahead,] = $.children;
158
+ const [term0, { children: terms }, repeat, disc, lookahead] = $.children;
156
159
  const acc = [compile(term0, lang, opts, flags)];
157
160
  if (terms) {
158
161
  for (let c of terms) {
@@ -183,7 +186,8 @@ compile.addAll({
183
186
  },
184
187
  charRange: ($, _, opts, flags) => {
185
188
  const [a, b] = $.children;
186
- opts.debug && console.log(`range: ${a.result} - ${b.result}`, flags);
189
+ opts.debug &&
190
+ console.log(`range: ${a.result} - ${b.result}`, flags);
187
191
  return (flags.discard ? rangeD : range)(a.result, b.result);
188
192
  },
189
193
  charSel: ($, lang, opts, flags) => {
@@ -197,7 +201,6 @@ compile.addAll({
197
201
  : parser;
198
202
  },
199
203
  });
200
- compile.add(DEFAULT, ($) => unsupported(`unknown op: ${$.id}`));
201
204
  const compileRepeat = (parser, rspec, opts) => {
202
205
  opts.debug && console.log(`repeat: ${rspec.id}`);
203
206
  if (rspec.id === "repeat") {
@@ -233,8 +236,22 @@ const compileRD = (parser, rspec, dspec, opts) => dspec.result != null && rspec.
233
236
  : compileDiscard(compileRepeat(parser(false), rspec, opts), dspec, opts);
234
237
  const compileRDL = (parser, rspec, dspec, lhspec, lang, opts) => compileLookahead(compileRD(parser, rspec, dspec, opts), lhspec, lang, opts);
235
238
  export const defGrammar = (rules, env, opts) => {
236
- opts = Object.assign({ debug: false, optimize: true }, opts);
237
- env = Object.assign({ binary: xfInt(2), collect: xfCollect, count: xfCount, discard: xfDiscard, float: xfFloat, hex: xfInt(16), hoist: xfHoist, hoistR: xfHoistResult, int: xfInt(10), join: xfJoin, print: xfPrint(), trim: xfTrim }, env);
239
+ opts = { debug: false, optimize: true, ...opts };
240
+ env = {
241
+ binary: xfInt(2),
242
+ collect: xfCollect,
243
+ count: xfCount,
244
+ discard: xfDiscard,
245
+ float: xfFloat,
246
+ hex: xfInt(16),
247
+ hoist: xfHoist,
248
+ hoistR: xfHoistResult,
249
+ int: xfInt(10),
250
+ join: xfJoin,
251
+ print: xfPrint(),
252
+ trim: xfTrim,
253
+ ...env,
254
+ };
238
255
  const ctx = defContext(rules);
239
256
  const result = (opts.debug ? print(GRAMMAR) : GRAMMAR)(ctx);
240
257
  if (result) {
package/index.d.ts CHANGED
@@ -1,50 +1,50 @@
1
- export * from "./api";
2
- export * from "./context";
3
- export * from "./error";
4
- export * from "./grammar";
5
- export * from "./combinators/alt";
6
- export * from "./combinators/boundary";
7
- export * from "./combinators/check";
8
- export * from "./combinators/dynamic";
9
- export * from "./combinators/expect";
10
- export * from "./combinators/lookahead";
11
- export * from "./combinators/maybe";
12
- export * from "./combinators/not";
13
- export * from "./combinators/repeat";
14
- export * from "./combinators/seq";
15
- export * from "./combinators/wrap";
16
- export * from "./combinators/xform";
17
- export * from "./presets/alpha";
18
- export * from "./presets/bits";
19
- export * from "./presets/digits";
20
- export * from "./presets/escape";
21
- export * from "./presets/hex";
22
- export * from "./presets/numbers";
23
- export * from "./presets/string";
24
- export * from "./presets/whitespace";
25
- export * from "./prims/always";
26
- export * from "./prims/anchor";
27
- export * from "./prims/fail";
28
- export * from "./prims/lit";
29
- export * from "./prims/none-of";
30
- export * from "./prims/one-of";
31
- export * from "./prims/pass";
32
- export * from "./prims/range";
33
- export * from "./prims/satisfy";
34
- export * from "./prims/skip";
35
- export * from "./prims/string";
36
- export * from "./readers/array-reader";
37
- export * from "./readers/string-reader";
38
- export * from "./xform/collect";
39
- export * from "./xform/comp";
40
- export * from "./xform/count";
41
- export * from "./xform/discard";
42
- export * from "./xform/hoist";
43
- export * from "./xform/join";
44
- export * from "./xform/nest";
45
- export * from "./xform/number";
46
- export * from "./xform/print";
47
- export * from "./xform/replace";
48
- export * from "./xform/trim";
49
- export * from "./xform/with-id";
1
+ export * from "./api.js";
2
+ export * from "./context.js";
3
+ export * from "./error.js";
4
+ export * from "./grammar.js";
5
+ export * from "./combinators/alt.js";
6
+ export * from "./combinators/boundary.js";
7
+ export * from "./combinators/check.js";
8
+ export * from "./combinators/dynamic.js";
9
+ export * from "./combinators/expect.js";
10
+ export * from "./combinators/lookahead.js";
11
+ export * from "./combinators/maybe.js";
12
+ export * from "./combinators/not.js";
13
+ export * from "./combinators/repeat.js";
14
+ export * from "./combinators/seq.js";
15
+ export * from "./combinators/wrap.js";
16
+ export * from "./combinators/xform.js";
17
+ export * from "./presets/alpha.js";
18
+ export * from "./presets/bits.js";
19
+ export * from "./presets/digits.js";
20
+ export * from "./presets/escape.js";
21
+ export * from "./presets/hex.js";
22
+ export * from "./presets/numbers.js";
23
+ export * from "./presets/string.js";
24
+ export * from "./presets/whitespace.js";
25
+ export * from "./prims/always.js";
26
+ export * from "./prims/anchor.js";
27
+ export * from "./prims/fail.js";
28
+ export * from "./prims/lit.js";
29
+ export * from "./prims/none-of.js";
30
+ export * from "./prims/one-of.js";
31
+ export * from "./prims/pass.js";
32
+ export * from "./prims/range.js";
33
+ export * from "./prims/satisfy.js";
34
+ export * from "./prims/skip.js";
35
+ export * from "./prims/string.js";
36
+ export * from "./readers/array-reader.js";
37
+ export * from "./readers/string-reader.js";
38
+ export * from "./xform/collect.js";
39
+ export * from "./xform/comp.js";
40
+ export * from "./xform/count.js";
41
+ export * from "./xform/discard.js";
42
+ export * from "./xform/hoist.js";
43
+ export * from "./xform/join.js";
44
+ export * from "./xform/nest.js";
45
+ export * from "./xform/number.js";
46
+ export * from "./xform/print.js";
47
+ export * from "./xform/replace.js";
48
+ export * from "./xform/trim.js";
49
+ export * from "./xform/with-id.js";
50
50
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -1,49 +1,49 @@
1
- export * from "./api";
2
- export * from "./context";
3
- export * from "./error";
4
- export * from "./grammar";
5
- export * from "./combinators/alt";
6
- export * from "./combinators/boundary";
7
- export * from "./combinators/check";
8
- export * from "./combinators/dynamic";
9
- export * from "./combinators/expect";
10
- export * from "./combinators/lookahead";
11
- export * from "./combinators/maybe";
12
- export * from "./combinators/not";
13
- export * from "./combinators/repeat";
14
- export * from "./combinators/seq";
15
- export * from "./combinators/wrap";
16
- export * from "./combinators/xform";
17
- export * from "./presets/alpha";
18
- export * from "./presets/bits";
19
- export * from "./presets/digits";
20
- export * from "./presets/escape";
21
- export * from "./presets/hex";
22
- export * from "./presets/numbers";
23
- export * from "./presets/string";
24
- export * from "./presets/whitespace";
25
- export * from "./prims/always";
26
- export * from "./prims/anchor";
27
- export * from "./prims/fail";
28
- export * from "./prims/lit";
29
- export * from "./prims/none-of";
30
- export * from "./prims/one-of";
31
- export * from "./prims/pass";
32
- export * from "./prims/range";
33
- export * from "./prims/satisfy";
34
- export * from "./prims/skip";
35
- export * from "./prims/string";
36
- export * from "./readers/array-reader";
37
- export * from "./readers/string-reader";
38
- export * from "./xform/collect";
39
- export * from "./xform/comp";
40
- export * from "./xform/count";
41
- export * from "./xform/discard";
42
- export * from "./xform/hoist";
43
- export * from "./xform/join";
44
- export * from "./xform/nest";
45
- export * from "./xform/number";
46
- export * from "./xform/print";
47
- export * from "./xform/replace";
48
- export * from "./xform/trim";
49
- export * from "./xform/with-id";
1
+ export * from "./api.js";
2
+ export * from "./context.js";
3
+ export * from "./error.js";
4
+ export * from "./grammar.js";
5
+ export * from "./combinators/alt.js";
6
+ export * from "./combinators/boundary.js";
7
+ export * from "./combinators/check.js";
8
+ export * from "./combinators/dynamic.js";
9
+ export * from "./combinators/expect.js";
10
+ export * from "./combinators/lookahead.js";
11
+ export * from "./combinators/maybe.js";
12
+ export * from "./combinators/not.js";
13
+ export * from "./combinators/repeat.js";
14
+ export * from "./combinators/seq.js";
15
+ export * from "./combinators/wrap.js";
16
+ export * from "./combinators/xform.js";
17
+ export * from "./presets/alpha.js";
18
+ export * from "./presets/bits.js";
19
+ export * from "./presets/digits.js";
20
+ export * from "./presets/escape.js";
21
+ export * from "./presets/hex.js";
22
+ export * from "./presets/numbers.js";
23
+ export * from "./presets/string.js";
24
+ export * from "./presets/whitespace.js";
25
+ export * from "./prims/always.js";
26
+ export * from "./prims/anchor.js";
27
+ export * from "./prims/fail.js";
28
+ export * from "./prims/lit.js";
29
+ export * from "./prims/none-of.js";
30
+ export * from "./prims/one-of.js";
31
+ export * from "./prims/pass.js";
32
+ export * from "./prims/range.js";
33
+ export * from "./prims/satisfy.js";
34
+ export * from "./prims/skip.js";
35
+ export * from "./prims/string.js";
36
+ export * from "./readers/array-reader.js";
37
+ export * from "./readers/string-reader.js";
38
+ export * from "./xform/collect.js";
39
+ export * from "./xform/comp.js";
40
+ export * from "./xform/count.js";
41
+ export * from "./xform/discard.js";
42
+ export * from "./xform/hoist.js";
43
+ export * from "./xform/join.js";
44
+ export * from "./xform/nest.js";
45
+ export * from "./xform/number.js";
46
+ export * from "./xform/print.js";
47
+ export * from "./xform/replace.js";
48
+ export * from "./xform/trim.js";
49
+ export * from "./xform/with-id.js";
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@thi.ng/parse",
3
- "version": "1.0.4",
3
+ "version": "2.0.3",
4
4
  "description": "Purely functional parser combinators & AST generation for generic inputs",
5
+ "type": "module",
5
6
  "module": "./index.js",
6
- "main": "./lib/index.js",
7
- "umd:main": "./lib/index.umd.js",
8
7
  "typings": "./index.d.ts",
8
+ "sideEffects": false,
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "https://github.com/thi-ng/umbrella.git"
@@ -24,36 +24,25 @@
24
24
  "author": "Karsten Schmidt <k+npm@thi.ng>",
25
25
  "license": "Apache-2.0",
26
26
  "scripts": {
27
- "build": "yarn clean && yarn build:es6 && node ../../scripts/bundle-module",
28
- "build:release": "yarn clean && yarn build:es6 && node ../../scripts/bundle-module all",
29
- "build:es6": "tsc --declaration",
30
- "build:test": "rimraf build && tsc -p test/tsconfig.json",
31
- "build:check": "tsc --isolatedModules --noEmit",
32
- "test": "mocha test",
33
- "cover": "nyc mocha test && nyc report --reporter=lcov",
34
- "clean": "rimraf *.js *.d.ts *.map .nyc_output build coverage doc lib combinators presets prims readers xform",
35
- "doc:readme": "ts-node -P ../../tools/tsconfig.json ../../tools/src/readme.ts",
27
+ "build": "yarn clean && tsc --declaration",
28
+ "clean": "rimraf *.js *.d.ts *.map doc combinators presets prims readers xform",
29
+ "doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
36
30
  "doc:ae": "mkdir -p .ae/doc .ae/temp && node_modules/.bin/api-extractor run --local --verbose",
37
- "doc": "typedoc --excludePrivate --out doc --theme ../../tools/doc/typedoc-theme src/index.ts",
38
- "pub": "yarn build:release && yarn publish --access public"
31
+ "doc:readme": "yarn doc:stats && ../../scripts/node-esm ../../tools/src/readme.ts",
32
+ "doc:stats": "../../scripts/node-esm ../../tools/src/module-stats.ts",
33
+ "pub": "yarn build && yarn publish --access public",
34
+ "test": "testament test"
39
35
  },
40
36
  "dependencies": {
41
- "@thi.ng/api": "^7.1.9",
42
- "@thi.ng/checks": "^2.9.10",
43
- "@thi.ng/defmulti": "^1.3.16",
44
- "@thi.ng/errors": "^1.3.4",
45
- "@thi.ng/strings": "^2.1.6"
37
+ "@thi.ng/api": "^8.0.3",
38
+ "@thi.ng/checks": "^3.0.3",
39
+ "@thi.ng/defmulti": "^2.0.3",
40
+ "@thi.ng/errors": "^2.0.3",
41
+ "@thi.ng/strings": "^3.0.3"
42
+ },
43
+ "devDependencies": {
44
+ "@thi.ng/testament": "^0.1.3"
46
45
  },
47
- "files": [
48
- "*.js",
49
- "*.d.ts",
50
- "lib",
51
- "combinators",
52
- "presets",
53
- "prims",
54
- "readers",
55
- "xform"
56
- ],
57
46
  "keywords": [
58
47
  "ast",
59
48
  "combinator",
@@ -73,7 +62,170 @@
73
62
  "publishConfig": {
74
63
  "access": "public"
75
64
  },
76
- "sideEffects": false,
65
+ "engines": {
66
+ "node": ">=12.7"
67
+ },
68
+ "files": [
69
+ "*.js",
70
+ "*.d.ts",
71
+ "combinators",
72
+ "presets",
73
+ "prims",
74
+ "readers",
75
+ "xform"
76
+ ],
77
+ "exports": {
78
+ ".": {
79
+ "import": "./index.js"
80
+ },
81
+ "./api": {
82
+ "import": "./api.js"
83
+ },
84
+ "./combinators/alt": {
85
+ "import": "./combinators/alt.js"
86
+ },
87
+ "./combinators/boundary": {
88
+ "import": "./combinators/boundary.js"
89
+ },
90
+ "./combinators/check": {
91
+ "import": "./combinators/check.js"
92
+ },
93
+ "./combinators/dynamic": {
94
+ "import": "./combinators/dynamic.js"
95
+ },
96
+ "./combinators/expect": {
97
+ "import": "./combinators/expect.js"
98
+ },
99
+ "./combinators/lookahead": {
100
+ "import": "./combinators/lookahead.js"
101
+ },
102
+ "./combinators/maybe": {
103
+ "import": "./combinators/maybe.js"
104
+ },
105
+ "./combinators/not": {
106
+ "import": "./combinators/not.js"
107
+ },
108
+ "./combinators/repeat": {
109
+ "import": "./combinators/repeat.js"
110
+ },
111
+ "./combinators/seq": {
112
+ "import": "./combinators/seq.js"
113
+ },
114
+ "./combinators/wrap": {
115
+ "import": "./combinators/wrap.js"
116
+ },
117
+ "./combinators/xform": {
118
+ "import": "./combinators/xform.js"
119
+ },
120
+ "./context": {
121
+ "import": "./context.js"
122
+ },
123
+ "./error": {
124
+ "import": "./error.js"
125
+ },
126
+ "./grammar": {
127
+ "import": "./grammar.js"
128
+ },
129
+ "./presets/alpha": {
130
+ "import": "./presets/alpha.js"
131
+ },
132
+ "./presets/bits": {
133
+ "import": "./presets/bits.js"
134
+ },
135
+ "./presets/digits": {
136
+ "import": "./presets/digits.js"
137
+ },
138
+ "./presets/escape": {
139
+ "import": "./presets/escape.js"
140
+ },
141
+ "./presets/hex": {
142
+ "import": "./presets/hex.js"
143
+ },
144
+ "./presets/numbers": {
145
+ "import": "./presets/numbers.js"
146
+ },
147
+ "./presets/string": {
148
+ "import": "./presets/string.js"
149
+ },
150
+ "./presets/whitespace": {
151
+ "import": "./presets/whitespace.js"
152
+ },
153
+ "./prims/always": {
154
+ "import": "./prims/always.js"
155
+ },
156
+ "./prims/anchor": {
157
+ "import": "./prims/anchor.js"
158
+ },
159
+ "./prims/fail": {
160
+ "import": "./prims/fail.js"
161
+ },
162
+ "./prims/lit": {
163
+ "import": "./prims/lit.js"
164
+ },
165
+ "./prims/none-of": {
166
+ "import": "./prims/none-of.js"
167
+ },
168
+ "./prims/one-of": {
169
+ "import": "./prims/one-of.js"
170
+ },
171
+ "./prims/pass": {
172
+ "import": "./prims/pass.js"
173
+ },
174
+ "./prims/range": {
175
+ "import": "./prims/range.js"
176
+ },
177
+ "./prims/satisfy": {
178
+ "import": "./prims/satisfy.js"
179
+ },
180
+ "./prims/skip": {
181
+ "import": "./prims/skip.js"
182
+ },
183
+ "./prims/string": {
184
+ "import": "./prims/string.js"
185
+ },
186
+ "./readers/array-reader": {
187
+ "import": "./readers/array-reader.js"
188
+ },
189
+ "./readers/string-reader": {
190
+ "import": "./readers/string-reader.js"
191
+ },
192
+ "./xform/collect": {
193
+ "import": "./xform/collect.js"
194
+ },
195
+ "./xform/comp": {
196
+ "import": "./xform/comp.js"
197
+ },
198
+ "./xform/count": {
199
+ "import": "./xform/count.js"
200
+ },
201
+ "./xform/discard": {
202
+ "import": "./xform/discard.js"
203
+ },
204
+ "./xform/hoist": {
205
+ "import": "./xform/hoist.js"
206
+ },
207
+ "./xform/join": {
208
+ "import": "./xform/join.js"
209
+ },
210
+ "./xform/nest": {
211
+ "import": "./xform/nest.js"
212
+ },
213
+ "./xform/number": {
214
+ "import": "./xform/number.js"
215
+ },
216
+ "./xform/print": {
217
+ "import": "./xform/print.js"
218
+ },
219
+ "./xform/replace": {
220
+ "import": "./xform/replace.js"
221
+ },
222
+ "./xform/trim": {
223
+ "import": "./xform/trim.js"
224
+ },
225
+ "./xform/with-id": {
226
+ "import": "./xform/with-id.js"
227
+ }
228
+ },
77
229
  "thi.ng": {
78
230
  "related": [
79
231
  "fsm",
@@ -81,5 +233,5 @@
81
233
  ],
82
234
  "year": 2020
83
235
  },
84
- "gitHead": "3365151f112c39f224541f5ac4cedf3370eb9ba4"
236
+ "gitHead": "1fb38cac74d6c009d96855c28784a267a81badf1"
85
237
  }
@@ -1,17 +1,17 @@
1
1
  /**
2
2
  * Matches single char in `a` - `z` range.
3
3
  */
4
- export declare const LOWER_CASE: import("..").LitParser<string>;
4
+ export declare const LOWER_CASE: import("../api.js").LitParser<string>;
5
5
  /**
6
6
  * Matches single char in `A` - `Z` range.
7
7
  */
8
- export declare const UPPER_CASE: import("..").LitParser<string>;
8
+ export declare const UPPER_CASE: import("../api.js").LitParser<string>;
9
9
  /**
10
10
  * Matches single in {@link LOWER_CASE} or {@link UPPER_CASE}.
11
11
  */
12
- export declare const ALPHA: import("..").LitParser<string>;
12
+ export declare const ALPHA: import("../api.js").LitParser<string>;
13
13
  /**
14
14
  * Matches single in {@link ALPHA} or {@link DIGIT}.
15
15
  */
16
- export declare const ALPHA_NUM: import("..").LitParser<string>;
16
+ export declare const ALPHA_NUM: import("../api.js").LitParser<string>;
17
17
  //# sourceMappingURL=alpha.d.ts.map
package/presets/alpha.js CHANGED
@@ -1,6 +1,6 @@
1
- import { ALPHA as _ALPHA, ALPHA_NUM as _ALPHA_NUM } from "@thi.ng/strings";
2
- import { oneOf } from "../prims/one-of";
3
- import { range } from "../prims/range";
1
+ import { ALPHA as _ALPHA, ALPHA_NUM as _ALPHA_NUM, } from "@thi.ng/strings/groups";
2
+ import { oneOf } from "../prims/one-of.js";
3
+ import { range } from "../prims/range.js";
4
4
  /**
5
5
  * Matches single char in `a` - `z` range.
6
6
  */