@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/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [1.0.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@1.0.3...@thi.ng/parse@1.0.4) (2021-08-17)
6
+ ## [2.0.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@2.0.2...@thi.ng/parse@2.0.3) (2021-10-15)
7
7
 
8
8
  **Note:** Version bump only for package @thi.ng/parse
9
9
 
@@ -11,7 +11,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
11
11
 
12
12
 
13
13
 
14
- ## [1.0.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@1.0.2...@thi.ng/parse@1.0.3) (2021-08-08)
14
+ ## [2.0.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@2.0.1...@thi.ng/parse@2.0.2) (2021-10-15)
15
15
 
16
16
  **Note:** Version bump only for package @thi.ng/parse
17
17
 
@@ -19,7 +19,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
19
19
 
20
20
 
21
21
 
22
- ## [1.0.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@1.0.1...@thi.ng/parse@1.0.2) (2021-08-08)
22
+ ## [2.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@2.0.0...@thi.ng/parse@2.0.1) (2021-10-13)
23
23
 
24
24
  **Note:** Version bump only for package @thi.ng/parse
25
25
 
@@ -27,189 +27,137 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
27
27
 
28
28
 
29
29
 
30
- ## [1.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@0.9.25...@thi.ng/parse@1.0.1) (2021-08-08)
31
-
32
- **Note:** Version bump only for package @thi.ng/parse
33
-
34
-
35
-
36
-
37
-
38
- ## [0.9.25](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@0.9.24...@thi.ng/parse@0.9.25) (2021-08-04)
39
-
40
- **Note:** Version bump only for package @thi.ng/parse
41
-
42
-
43
-
44
-
45
-
46
- ## [0.9.24](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@0.9.23...@thi.ng/parse@0.9.24) (2021-07-01)
47
-
48
- **Note:** Version bump only for package @thi.ng/parse
49
-
50
-
51
-
52
-
53
-
54
- ## [0.9.23](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@0.9.22...@thi.ng/parse@0.9.23) (2021-06-08)
55
-
56
- **Note:** Version bump only for package @thi.ng/parse
57
-
58
-
59
-
60
-
61
-
62
- # [0.9.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@0.8.2...@thi.ng/parse@0.9.0) (2020-08-17)
63
-
64
-
65
- ### Features
66
-
67
- * **parse:** add replace/xfReplace() xform ([7291181](https://github.com/thi-ng/umbrella/commit/7291181f6eb74751aa02dffbb95bb6787a5ef02f))
68
- * **parse:** enable replacement rule transforms ([ca22432](https://github.com/thi-ng/umbrella/commit/ca224328e55cb525cefd39dd53028a86a580fd7e))
69
-
70
-
71
-
72
-
73
-
74
- # [0.8.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@0.7.2...@thi.ng/parse@0.8.0) (2020-07-19)
75
-
76
-
77
- ### Features
78
-
79
- * **parse:** add nest()/xfNest() transform ([af9c97b](https://github.com/thi-ng/umbrella/commit/af9c97b55cba15175bff917d0b2522be8c98517d))
80
- * **parse:** update grammar (xform rule refs) ([22188a4](https://github.com/thi-ng/umbrella/commit/22188a41d5db58fb9dae9cb01bd04ad8d1ac788e))
81
- * **parse:** update repeat grammar ([7aae9ac](https://github.com/thi-ng/umbrella/commit/7aae9ac02d23dd7e5a0643d3a418be67044465bd))
82
-
83
-
84
-
85
-
86
-
87
- ## [0.7.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@0.7.1...@thi.ng/parse@0.7.2) (2020-07-18)
88
-
89
-
90
- ### Bug Fixes
91
-
92
- * **parse:** export ContextOpts, move to api.ts ([2dfc445](https://github.com/thi-ng/umbrella/commit/2dfc445971dc788abcb6576ef4e6836dec6df33a))
93
-
94
-
95
-
96
-
97
-
98
- ## [0.7.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@0.7.0...@thi.ng/parse@0.7.1) (2020-07-17)
99
-
100
-
101
- ### Performance Improvements
102
-
103
- * **parse:** update grammar, use discarding parsers where possible ([d269a8a](https://github.com/thi-ng/umbrella/commit/d269a8a3f5b5ee47d60f86343a163c9903ce6923))
104
-
105
-
106
-
107
-
108
-
109
- # [0.7.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@0.6.2...@thi.ng/parse@0.7.0) (2020-07-08)
110
-
111
-
112
- ### Features
113
-
114
- * **parse:** add lookahead() combinator, add tests ([ee35038](https://github.com/thi-ng/umbrella/commit/ee35038cdae0692cc369221eb7623ba7b973d2f1))
115
- * **parse:** lookahead w/ configurable capture ([542c066](https://github.com/thi-ng/umbrella/commit/542c0662b4901a6cfd32a99e5241dace0ddde807))
116
- * **parse:** turn xfPrint() into HOF xform ([d86fa53](https://github.com/thi-ng/umbrella/commit/d86fa535a530f0fe84e08e5969ca01c96ef75c23))
117
- * **parse:** update grammar DSL ([accacf9](https://github.com/thi-ng/umbrella/commit/accacf9fa73b09f6cb8454cd4d85f10bb0f55795))
118
- * **parse:** update lookahead ([51a8dc5](https://github.com/thi-ng/umbrella/commit/51a8dc55dd3b40fcfbffbcb5f3aeaea618441269))
119
- * **parse:** update/fix grammar DSL, add trim ([f82ba1f](https://github.com/thi-ng/umbrella/commit/f82ba1f9aeed03571e50953c6d41255a569d121f))
120
-
121
-
30
+ # [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@1.0.5...@thi.ng/parse@2.0.0) (2021-10-12)
122
31
 
123
32
 
33
+ ### Build System
124
34
 
125
- # [0.6.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@0.5.8...@thi.ng/parse@0.6.0) (2020-06-28)
35
+ * major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea9fab2a645d6c5f2bf2591459b939c09b6))
126
36
 
127
37
 
128
- ### Features
38
+ ### BREAKING CHANGES
129
39
 
130
- * **parse:** add `!` discard modifier to grammar ([456efdc](https://github.com/thi-ng/umbrella/commit/456efdcb6ded913b0f2b137ebe99634421d552c0))
131
- * **parse:** add count/xfCount transform ([056ae08](https://github.com/thi-ng/umbrella/commit/056ae084c08a826f09c65181c01426bbdff59e87))
40
+ * discontinue CommonJS & UMD versions
132
41
 
42
+ - only ESM modules will be published from now on
43
+ - CJS obsolete due to ESM support in recent versions of node:
44
+ - i.e. launch NodeJS via:
45
+ - `node --experimental-specifier-resolution=node --experimental-repl-await`
46
+ - in the node REPL use `await import(...)` instead of `require()`
47
+ - UMD obsolete due to widespread browser support for ESM
133
48
 
49
+ Also:
50
+ - normalize/restructure/reorg all package.json files
51
+ - cleanup all build scripts, remove obsolete
52
+ - switch from mocha to @thi.ng/testament for all tests
134
53
 
135
54
 
136
55
 
137
- # [0.5.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@0.4.1...@thi.ng/parse@0.5.0) (2020-04-23)
138
56
 
139
57
 
140
- ### Features
141
58
 
142
- * **parse:** add built-ins, extract STRING, minor updates ([458f5b3](https://github.com/thi-ng/umbrella/commit/458f5b34a4fa1c58f55b23be8455e6bd7b7bb72d))
59
+ ## [1.0.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@1.0.4...@thi.ng/parse@1.0.5) (2021-09-03)
143
60
 
61
+ **Note:** Version bump only for package @thi.ng/parse
144
62
 
63
+ # [0.9.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@0.8.2...@thi.ng/parse@0.9.0) (2020-08-17)
145
64
 
65
+ ### Features
146
66
 
67
+ - **parse:** add replace/xfReplace() xform ([7291181](https://github.com/thi-ng/umbrella/commit/7291181f6eb74751aa02dffbb95bb6787a5ef02f))
68
+ - **parse:** enable replacement rule transforms ([ca22432](https://github.com/thi-ng/umbrella/commit/ca224328e55cb525cefd39dd53028a86a580fd7e))
147
69
 
148
- # [0.4.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@0.3.0...@thi.ng/parse@0.4.0) (2020-04-21)
70
+ # [0.8.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@0.7.2...@thi.ng/parse@0.8.0) (2020-07-19)
149
71
 
72
+ ### Features
150
73
 
151
- ### Bug Fixes
74
+ - **parse:** add nest()/xfNest() transform ([af9c97b](https://github.com/thi-ng/umbrella/commit/af9c97b55cba15175bff917d0b2522be8c98517d))
75
+ - **parse:** update grammar (xform rule refs) ([22188a4](https://github.com/thi-ng/umbrella/commit/22188a41d5db58fb9dae9cb01bd04ad8d1ac788e))
76
+ - **parse:** update repeat grammar ([7aae9ac](https://github.com/thi-ng/umbrella/commit/7aae9ac02d23dd7e5a0643d3a418be67044465bd))
152
77
 
153
- * **parse:** update not() behavior, add passD() ([1d0f4c4](https://github.com/thi-ng/umbrella/commit/1d0f4c4baef5b1cfb207f606f4e3873a14c3afce))
78
+ ## [0.7.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@0.7.1...@thi.ng/parse@0.7.2) (2020-07-18)
154
79
 
80
+ ### Bug Fixes
155
81
 
156
- ### Features
82
+ - **parse:** export ContextOpts, move to api.ts ([2dfc445](https://github.com/thi-ng/umbrella/commit/2dfc445971dc788abcb6576ef4e6836dec6df33a))
157
83
 
158
- * **parse:** update grammar DSL, hoist xforms ([861e7f3](https://github.com/thi-ng/umbrella/commit/861e7f32d98a9f693a9271d31235d1603700b36c))
84
+ ## [0.7.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@0.7.0...@thi.ng/parse@0.7.1) (2020-07-17)
159
85
 
86
+ ### Performance Improvements
160
87
 
88
+ - **parse:** update grammar, use discarding parsers where possible ([d269a8a](https://github.com/thi-ng/umbrella/commit/d269a8a3f5b5ee47d60f86343a163c9903ce6923))
161
89
 
90
+ # [0.7.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@0.6.2...@thi.ng/parse@0.7.0) (2020-07-08)
162
91
 
92
+ ### Features
163
93
 
164
- # [0.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@0.2.0...@thi.ng/parse@0.3.0) (2020-04-20)
94
+ - **parse:** add lookahead() combinator, add tests ([ee35038](https://github.com/thi-ng/umbrella/commit/ee35038cdae0692cc369221eb7623ba7b973d2f1))
95
+ - **parse:** lookahead w/ configurable capture ([542c066](https://github.com/thi-ng/umbrella/commit/542c0662b4901a6cfd32a99e5241dace0ddde807))
96
+ - **parse:** turn xfPrint() into HOF xform ([d86fa53](https://github.com/thi-ng/umbrella/commit/d86fa535a530f0fe84e08e5969ca01c96ef75c23))
97
+ - **parse:** update grammar DSL ([accacf9](https://github.com/thi-ng/umbrella/commit/accacf9fa73b09f6cb8454cd4d85f10bb0f55795))
98
+ - **parse:** update lookahead ([51a8dc5](https://github.com/thi-ng/umbrella/commit/51a8dc55dd3b40fcfbffbcb5f3aeaea618441269))
99
+ - **parse:** update/fix grammar DSL, add trim ([f82ba1f](https://github.com/thi-ng/umbrella/commit/f82ba1f9aeed03571e50953c6d41255a569d121f))
165
100
 
101
+ # [0.6.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@0.5.8...@thi.ng/parse@0.6.0) (2020-06-28)
166
102
 
167
- ### Features
103
+ ### Features
168
104
 
169
- * **parse:** add discarding combinators, move discard ([e09a2c4](https://github.com/thi-ng/umbrella/commit/e09a2c40d1ad7272a5abc15c8b11e497f79eb0dd))
170
- * **parse:** add dynamic() & DynamicParser ([b914267](https://github.com/thi-ng/umbrella/commit/b914267b88325d5c94a028aee192268e75736181))
171
- * **parse:** add grammar default transforms, update/fix rules ([03ed965](https://github.com/thi-ng/umbrella/commit/03ed96592f1598767d5feeac1b49b8cc4b1d6285))
172
- * **parse:** add more whitespace presets ([1398e2b](https://github.com/thi-ng/umbrella/commit/1398e2b06a8eace8b61333c36db6e82d6e1478f3))
173
- * **parse:** add ParseContext.reset(), update addChild() ([d47c0a2](https://github.com/thi-ng/umbrella/commit/d47c0a220e4912a30c59a7fd3c81b8376d74d720))
174
- * **parse:** add skipWhile(), more discarded wrappers ([832c0b7](https://github.com/thi-ng/umbrella/commit/832c0b7e88d87b2da0e37f602e592ad7b548da09))
175
- * **parse:** add withID() xform, add doc strings ([e16426b](https://github.com/thi-ng/umbrella/commit/e16426b82f0dda94ab9aa92ba6e3af8d769f3fed))
176
- * **parse:** add/update combinators ([e4eab03](https://github.com/thi-ng/umbrella/commit/e4eab036243f4f646880b974624ae680e77cff7f))
177
- * **parse:** add/update/rename parser presets ([12f2499](https://github.com/thi-ng/umbrella/commit/12f2499253163a923c42e3be29ce2223a6648e11))
178
- * **parse:** add/update/rename parser primitives ([328103f](https://github.com/thi-ng/umbrella/commit/328103f55f4bb311470b8767a27d28a78d0dcb4b))
179
- * **parse:** initial checkin grammar compiler ([38e9c66](https://github.com/thi-ng/umbrella/commit/38e9c66c25c02db4d7fb79837645dfaf654e6788))
180
- * **parse:** update ESC & whitespace parsers ([069a6ef](https://github.com/thi-ng/umbrella/commit/069a6ef11c9423bdb2974b11823cc39743dfceec))
181
- * **parse:** update grammar parser & compiler ([822fcba](https://github.com/thi-ng/umbrella/commit/822fcba9a29a05bad98eecf2b341d07a3a90abeb))
105
+ - **parse:** add `!` discard modifier to grammar ([456efdc](https://github.com/thi-ng/umbrella/commit/456efdcb6ded913b0f2b137ebe99634421d552c0))
106
+ - **parse:** add count/xfCount transform ([056ae08](https://github.com/thi-ng/umbrella/commit/056ae084c08a826f09c65181c01426bbdff59e87))
182
107
 
108
+ # [0.5.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@0.4.1...@thi.ng/parse@0.5.0) (2020-04-23)
183
109
 
110
+ ### Features
184
111
 
112
+ - **parse:** add built-ins, extract STRING, minor updates ([458f5b3](https://github.com/thi-ng/umbrella/commit/458f5b34a4fa1c58f55b23be8455e6bd7b7bb72d))
185
113
 
114
+ # [0.4.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@0.3.0...@thi.ng/parse@0.4.0) (2020-04-21)
186
115
 
187
- # [0.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@0.1.0...@thi.ng/parse@0.2.0) (2020-04-17)
116
+ ### Bug Fixes
188
117
 
118
+ - **parse:** update not() behavior, add passD() ([1d0f4c4](https://github.com/thi-ng/umbrella/commit/1d0f4c4baef5b1cfb207f606f4e3873a14c3afce))
189
119
 
190
- ### Features
120
+ ### Features
191
121
 
192
- * **parse:** add/rename/reorg parsers, xforms, ctx ([ee537f4](https://github.com/thi-ng/umbrella/commit/ee537f49c239de19326865687853e9b2814330bf))
122
+ - **parse:** update grammar DSL, hoist xforms ([861e7f3](https://github.com/thi-ng/umbrella/commit/861e7f32d98a9f693a9271d31235d1603700b36c))
193
123
 
124
+ # [0.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@0.2.0...@thi.ng/parse@0.3.0) (2020-04-20)
194
125
 
195
- ### Performance Improvements
126
+ ### Features
196
127
 
197
- * **parse:** major speedup satisfy() (~1.6x faster) ([8ca5c7f](https://github.com/thi-ng/umbrella/commit/8ca5c7f184af3d03f06b03b9136a675fb9e63d64))
128
+ - **parse:** add discarding combinators, move discard ([e09a2c4](https://github.com/thi-ng/umbrella/commit/e09a2c40d1ad7272a5abc15c8b11e497f79eb0dd))
129
+ - **parse:** add dynamic() & DynamicParser ([b914267](https://github.com/thi-ng/umbrella/commit/b914267b88325d5c94a028aee192268e75736181))
130
+ - **parse:** add grammar default transforms, update/fix rules ([03ed965](https://github.com/thi-ng/umbrella/commit/03ed96592f1598767d5feeac1b49b8cc4b1d6285))
131
+ - **parse:** add more whitespace presets ([1398e2b](https://github.com/thi-ng/umbrella/commit/1398e2b06a8eace8b61333c36db6e82d6e1478f3))
132
+ - **parse:** add ParseContext.reset(), update addChild() ([d47c0a2](https://github.com/thi-ng/umbrella/commit/d47c0a220e4912a30c59a7fd3c81b8376d74d720))
133
+ - **parse:** add skipWhile(), more discarded wrappers ([832c0b7](https://github.com/thi-ng/umbrella/commit/832c0b7e88d87b2da0e37f602e592ad7b548da09))
134
+ - **parse:** add withID() xform, add doc strings ([e16426b](https://github.com/thi-ng/umbrella/commit/e16426b82f0dda94ab9aa92ba6e3af8d769f3fed))
135
+ - **parse:** add/update combinators ([e4eab03](https://github.com/thi-ng/umbrella/commit/e4eab036243f4f646880b974624ae680e77cff7f))
136
+ - **parse:** add/update/rename parser presets ([12f2499](https://github.com/thi-ng/umbrella/commit/12f2499253163a923c42e3be29ce2223a6648e11))
137
+ - **parse:** add/update/rename parser primitives ([328103f](https://github.com/thi-ng/umbrella/commit/328103f55f4bb311470b8767a27d28a78d0dcb4b))
138
+ - **parse:** initial checkin grammar compiler ([38e9c66](https://github.com/thi-ng/umbrella/commit/38e9c66c25c02db4d7fb79837645dfaf654e6788))
139
+ - **parse:** update ESC & whitespace parsers ([069a6ef](https://github.com/thi-ng/umbrella/commit/069a6ef11c9423bdb2974b11823cc39743dfceec))
140
+ - **parse:** update grammar parser & compiler ([822fcba](https://github.com/thi-ng/umbrella/commit/822fcba9a29a05bad98eecf2b341d07a3a90abeb))
198
141
 
142
+ # [0.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/parse@0.1.0...@thi.ng/parse@0.2.0) (2020-04-17)
199
143
 
144
+ ### Features
200
145
 
146
+ - **parse:** add/rename/reorg parsers, xforms, ctx ([ee537f4](https://github.com/thi-ng/umbrella/commit/ee537f49c239de19326865687853e9b2814330bf))
201
147
 
148
+ ### Performance Improvements
202
149
 
203
- # 0.1.0 (2020-04-16)
150
+ - **parse:** major speedup satisfy() (~1.6x faster) ([8ca5c7f](https://github.com/thi-ng/umbrella/commit/8ca5c7f184af3d03f06b03b9136a675fb9e63d64))
204
151
 
152
+ # 0.1.0 (2020-04-16)
205
153
 
206
- ### Features
154
+ ### Features
207
155
 
208
- * **parse:** add ArrayReader, update pkg info ([3bec0db](https://github.com/thi-ng/umbrella/commit/3bec0dbf759d9742adefb936e58359f95da58fc8))
209
- * **parse:** add collect/xfCollect, update xfPrint ([43f3368](https://github.com/thi-ng/umbrella/commit/43f33687431f9ea8269c1eba0342d0589f7ac4dc))
210
- * **parse:** add ctx getters, add presets, update maybe ([02597bf](https://github.com/thi-ng/umbrella/commit/02597bf825df3e467cf2d090c69198d85f1767f2))
211
- * **parse:** import as new package ([151e50c](https://github.com/thi-ng/umbrella/commit/151e50cc1e2bfaf8d70a6bb82907eec483dd8316))
212
- * **parse:** make retained state info optional ([a89ee87](https://github.com/thi-ng/umbrella/commit/a89ee871a098582c909fcf8558ed979d04942250))
213
- * **parse:** update defContext, add basic array test ([cd7363d](https://github.com/thi-ng/umbrella/commit/cd7363d7f93e0db00797a9ec30bd44b399396860))
214
- * **parse:** update ParseContext, repeat & lift ([bef1d4f](https://github.com/thi-ng/umbrella/commit/bef1d4f628320d1aac9cf6d924749d4f15864d07))
215
- * **parse:** update repeat ops, reader, initial state ([c5cfabe](https://github.com/thi-ng/umbrella/commit/c5cfabeaf5ab6e124d5fc2455fd3f5ede96248cd))
156
+ - **parse:** add ArrayReader, update pkg info ([3bec0db](https://github.com/thi-ng/umbrella/commit/3bec0dbf759d9742adefb936e58359f95da58fc8))
157
+ - **parse:** add collect/xfCollect, update xfPrint ([43f3368](https://github.com/thi-ng/umbrella/commit/43f33687431f9ea8269c1eba0342d0589f7ac4dc))
158
+ - **parse:** add ctx getters, add presets, update maybe ([02597bf](https://github.com/thi-ng/umbrella/commit/02597bf825df3e467cf2d090c69198d85f1767f2))
159
+ - **parse:** import as new package ([151e50c](https://github.com/thi-ng/umbrella/commit/151e50cc1e2bfaf8d70a6bb82907eec483dd8316))
160
+ - **parse:** make retained state info optional ([a89ee87](https://github.com/thi-ng/umbrella/commit/a89ee871a098582c909fcf8558ed979d04942250))
161
+ - **parse:** update defContext, add basic array test ([cd7363d](https://github.com/thi-ng/umbrella/commit/cd7363d7f93e0db00797a9ec30bd44b399396860))
162
+ - **parse:** update ParseContext, repeat & lift ([bef1d4f](https://github.com/thi-ng/umbrella/commit/bef1d4f628320d1aac9cf6d924749d4f15864d07))
163
+ - **parse:** update repeat ops, reader, initial state ([c5cfabe](https://github.com/thi-ng/umbrella/commit/c5cfabeaf5ab6e124d5fc2455fd3f5ede96248cd))
package/README.md CHANGED
@@ -73,15 +73,24 @@ Purely functional parser combinators & AST generation for generic inputs.
73
73
  yarn add @thi.ng/parse
74
74
  ```
75
75
 
76
+ ES module import:
77
+
76
78
  ```html
77
- // ES module
78
- <script type="module" src="https://unpkg.com/@thi.ng/parse?module" crossorigin></script>
79
+ <script type="module" src="https://cdn.skypack.dev/@thi.ng/parse"></script>
80
+ ```
81
+
82
+ [Skypack documentation](https://docs.skypack.dev/)
83
+
84
+ For Node.js REPL:
85
+
86
+ ```text
87
+ # with flag only for < v16
88
+ node --experimental-repl-await
79
89
 
80
- // UMD
81
- <script src="https://unpkg.com/@thi.ng/parse/lib/index.umd.js" crossorigin></script>
90
+ > const parse = await import("@thi.ng/parse");
82
91
  ```
83
92
 
84
- Package sizes (gzipped, pre-treeshake): ESM: 5.24 KB / CJS: 5.63 KB / UMD: 5.29 KB
93
+ Package sizes (gzipped, pre-treeshake): ESM: 5.28 KB
85
94
 
86
95
  ## Dependencies
87
96
 
@@ -100,7 +109,7 @@ directory are using this package.
100
109
  A selection:
101
110
 
102
111
  | Screenshot | Description | Live demo | Source |
103
- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- | ------------------------------------------------------ | ----------------------------------------------------------------------------------- |
112
+ |:------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------|:-------------------------------------------------------|:------------------------------------------------------------------------------------|
104
113
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/parse-playground.png" width="240"/> | Parser grammar livecoding editor/playground & codegen | [Demo](https://demo.thi.ng/umbrella/parse-playground/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/parse-playground) |
105
114
 
106
115
  **Note:** Please also see the [dedicated wiki
package/api.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Fn, Fn0, IObjectOf, Nullable } from "@thi.ng/api";
2
- import type { ParseContext } from "./context";
2
+ import type { ParseContext } from "./context.js";
3
3
  export interface ParseScope<T> {
4
4
  id: string;
5
5
  state: Nullable<ParseState<T>>;
@@ -1,4 +1,4 @@
1
- import type { Parser } from "../api";
1
+ import type { Parser } from "../api.js";
2
2
  export declare const alt: <T>(parsers: Parser<T>[]) => Parser<T>;
3
3
  export declare const altD: <T>(parsers: Parser<T>[]) => Parser<any>;
4
4
  //# sourceMappingURL=alt.d.ts.map
@@ -1,4 +1,4 @@
1
- import { discard } from "../xform/discard";
1
+ import { discard } from "../xform/discard.js";
2
2
  export const alt = (parsers) => (ctx) => {
3
3
  if (ctx.done)
4
4
  return false;
@@ -1,4 +1,4 @@
1
- import type { Parser } from "../api";
1
+ import type { Parser } from "../api.js";
2
2
  export declare const startsWith: <T>(parser: Parser<T>) => Parser<T>;
3
3
  export declare const endsWith: <T>(parser: Parser<T>) => Parser<T>;
4
4
  export declare const entireLine: (parser: Parser<string>) => Parser<string>;
@@ -1,5 +1,5 @@
1
- import { inputEnd, inputStart, lineEnd, lineStart } from "../prims/anchor";
2
- import { seq } from "./seq";
1
+ import { inputEnd, inputStart, lineEnd, lineStart } from "../prims/anchor.js";
2
+ import { seq } from "./seq.js";
3
3
  export const startsWith = (parser) => seq([inputStart, parser]);
4
4
  export const endsWith = (parser) => seq([parser, inputEnd]);
5
5
  export const entireLine = (parser) => seq([lineStart, parser, lineEnd]);
@@ -1,4 +1,4 @@
1
1
  import type { Predicate } from "@thi.ng/api";
2
- import type { Parser, ParseScope } from "../api";
2
+ import type { Parser, ParseScope } from "../api.js";
3
3
  export declare const check: <T>(parser: Parser<T>, pred: Predicate<ParseScope<T>>, msg?: string) => Parser<T>;
4
4
  //# sourceMappingURL=check.d.ts.map
@@ -1,5 +1,5 @@
1
- import { parseError } from "../error";
2
- import { xform } from "./xform";
1
+ import { parseError } from "../error.js";
2
+ import { xform } from "./xform.js";
3
3
  export const check = (parser, pred, msg = "check failed") => xform(parser, (scope, ctx) => {
4
4
  if (!pred(scope))
5
5
  parseError(ctx, msg);
@@ -1,4 +1,4 @@
1
- import type { DynamicParser } from "../api";
1
+ import type { DynamicParser } from "../api.js";
2
2
  /**
3
3
  * Returns a parser function placeholder, whose implementation can be
4
4
  * set at a later stage via calling `.set()`.
@@ -1,3 +1,3 @@
1
- import type { Parser } from "../api";
1
+ import type { Parser } from "../api.js";
2
2
  export declare const expect: <T>(parser: Parser<T>, err: string) => Parser<T>;
3
3
  //# sourceMappingURL=expect.d.ts.map
@@ -1,2 +1,2 @@
1
- import { parseError } from "../error";
1
+ import { parseError } from "../error.js";
2
2
  export const expect = (parser, err) => (ctx) => parser(ctx) || parseError(ctx, err);
@@ -1,4 +1,4 @@
1
- import type { Parser } from "../api";
1
+ import type { Parser } from "../api.js";
2
2
  /**
3
3
  * Repeatedly runs `main` and look-`ahead` parsers for as long as the
4
4
  * former succeeds and UNTIL the latter passes or end of input is
@@ -67,7 +67,7 @@ export const lookahead = (parser, ahead, capture = false, id = "lookahead") => (
67
67
  ctx.start(id);
68
68
  let pass = false;
69
69
  while (true) {
70
- const state = capture ? null : Object.assign({}, ctx.state);
70
+ const state = capture ? null : { ...ctx.state };
71
71
  if (ahead(ctx)) {
72
72
  !capture && (ctx.state = state);
73
73
  return pass ? ctx.end() : ctx.discard();
@@ -1,3 +1,3 @@
1
- import type { Parser, PassValue } from "../api";
1
+ import type { Parser, PassValue } from "../api.js";
2
2
  export declare const maybe: <T, R = any>(parser: Parser<T>, result?: PassValue<R> | undefined, id?: string) => Parser<T>;
3
3
  //# sourceMappingURL=maybe.d.ts.map
@@ -1,2 +1,2 @@
1
- import { pass } from "../prims/pass";
1
+ import { pass } from "../prims/pass.js";
2
2
  export const maybe = (parser, result, id = "maybe") => (ctx) => parser(ctx) || pass(result, id)(ctx);
@@ -1,4 +1,4 @@
1
- import type { Parser } from "../api";
1
+ import type { Parser } from "../api.js";
2
2
  /**
3
3
  * Runs `parser`, discards its result and if it passed returns false,
4
4
  * else runs `fail` parser and returns its result. By default `fail` is
@@ -1,4 +1,4 @@
1
- import { always } from "../prims/always";
1
+ import { always } from "../prims/always.js";
2
2
  /**
3
3
  * Runs `parser`, discards its result and if it passed returns false,
4
4
  * else runs `fail` parser and returns its result. By default `fail` is
@@ -1,4 +1,4 @@
1
- import type { Parser } from "../api";
1
+ import type { Parser } from "../api.js";
2
2
  export declare const repeat: <T>(parser: Parser<T>, min: number, max: number, id?: string) => Parser<T>;
3
3
  export declare const zeroOrMore: <T>(parser: Parser<T>, id?: string, max?: number) => Parser<T>;
4
4
  export declare const oneOrMore: <T>(parser: Parser<T>, id?: string, max?: number) => Parser<T>;
@@ -1,4 +1,4 @@
1
- import { discard } from "../xform/discard";
1
+ import { discard } from "../xform/discard.js";
2
2
  export const repeat = (parser, min, max, id = "repeat") => (ctx) => {
3
3
  if (ctx.done) {
4
4
  return min < 1 ? ctx.addChild(id) : false;
@@ -1,4 +1,4 @@
1
- import type { Parser } from "../api";
1
+ import type { Parser } from "../api.js";
2
2
  export declare const seq: <T>(parsers: Parser<T>[], id?: string) => Parser<T>;
3
3
  export declare const seqD: <T>(parsers: Parser<T>[]) => Parser<any>;
4
4
  //# sourceMappingURL=seq.d.ts.map
@@ -1,4 +1,4 @@
1
- import { discard } from "../xform/discard";
1
+ import { discard } from "../xform/discard.js";
2
2
  export const seq = (parsers, id = "seq") => (ctx) => {
3
3
  if (ctx.done)
4
4
  return false;
@@ -1,3 +1,3 @@
1
- import type { Parser } from "../api";
1
+ import type { Parser } from "../api.js";
2
2
  export declare const wrap: <T>(parser: Parser<T>, pre: T, post?: T) => Parser<T>;
3
3
  //# sourceMappingURL=wrap.d.ts.map
@@ -1,4 +1,4 @@
1
- import { litD } from "../prims/lit";
2
- import { hoist } from "../xform/hoist";
3
- import { seq } from "./seq";
1
+ import { litD } from "../prims/lit.js";
2
+ import { hoist } from "../xform/hoist.js";
3
+ import { seq } from "./seq.js";
4
4
  export const wrap = (parser, pre, post = pre) => hoist(seq([litD(pre), parser, litD(post)]));
@@ -1,3 +1,3 @@
1
- import type { Parser, ScopeTransform } from "../api";
1
+ import type { Parser, ScopeTransform } from "../api.js";
2
2
  export declare const xform: <T>(parser: Parser<T>, xf: ScopeTransform<T>, user?: any) => Parser<T>;
3
3
  //# sourceMappingURL=xform.d.ts.map
package/context.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ContextOpts, IReader, ParseScope, ParseState } from "./api";
1
+ import type { ContextOpts, IReader, ParseScope, ParseState } from "./api.js";
2
2
  export declare class ParseContext<T> {
3
3
  reader: IReader<T>;
4
4
  opts: ContextOpts;
package/context.js CHANGED
@@ -1,12 +1,13 @@
1
- import { isArrayLike, isString } from "@thi.ng/checks";
2
- import { parseError } from "./error";
3
- import { defArrayReader } from "./readers/array-reader";
4
- import { defStringReader } from "./readers/string-reader";
5
- import { indent } from "./utils";
1
+ import { isArrayLike } from "@thi.ng/checks/is-arraylike";
2
+ import { isString } from "@thi.ng/checks/is-string";
3
+ import { parseError } from "./error.js";
4
+ import { defArrayReader } from "./readers/array-reader.js";
5
+ import { defStringReader } from "./readers/string-reader.js";
6
+ import { indent } from "./utils.js";
6
7
  export class ParseContext {
7
8
  constructor(reader, opts) {
8
9
  this.reader = reader;
9
- this.opts = Object.assign({ maxDepth: 32, debug: false, retain: false }, opts);
10
+ this.opts = { maxDepth: 32, debug: false, retain: false, ...opts };
10
11
  this._maxDepth = this.opts.maxDepth;
11
12
  this._debug = this.opts.debug;
12
13
  this._retain = this.opts.retain;
@@ -30,7 +31,7 @@ export class ParseContext {
30
31
  const scopes = this._scopes;
31
32
  const scope = {
32
33
  id,
33
- state: Object.assign({}, scopes[scopes.length - 1].state),
34
+ state: { ...scopes[scopes.length - 1].state },
34
35
  children: null,
35
36
  result: null,
36
37
  };
package/error.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import type { ParseContext } from "./context";
1
+ import type { ParseContext } from "./context.js";
2
2
  export declare const parseError: (ctx: ParseContext<any>, msg: string) => never;
3
3
  //# sourceMappingURL=error.d.ts.map
package/error.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defError } from "@thi.ng/errors";
1
+ import { defError } from "@thi.ng/errors/deferror";
2
2
  const ParseError = defError(() => `ParseError`);
3
3
  export const parseError = (ctx, msg) => {
4
4
  const info = ctx.reader.format(ctx.scope.state);
package/grammar.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { GrammarOpts, Language, Parser, RuleTransforms } from "./api";
1
+ import type { GrammarOpts, Language, Parser, RuleTransforms } from "./api.js";
2
2
  export declare const GRAMMAR: Parser<string>;
3
3
  export declare const defGrammar: (rules: string, env?: RuleTransforms | undefined, opts?: Partial<GrammarOpts> | undefined) => Language | undefined;
4
4
  //# sourceMappingURL=grammar.d.ts.map