@thomasfosterau/effect-parse 0.0.0 → 0.2.0

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 (155) hide show
  1. package/README.md +247 -230
  2. package/dist/Ascii.d.ts +32 -53
  3. package/dist/Ascii.d.ts.map +1 -1
  4. package/dist/Ascii.js +576 -571
  5. package/dist/Ascii.js.map +1 -1
  6. package/dist/Binary.d.ts +6 -29
  7. package/dist/Binary.d.ts.map +1 -1
  8. package/dist/Binary.js +129 -116
  9. package/dist/Binary.js.map +1 -1
  10. package/dist/Bits.d.ts +4 -2
  11. package/dist/Bits.d.ts.map +1 -1
  12. package/dist/Bits.js +121 -123
  13. package/dist/Bits.js.map +1 -1
  14. package/dist/Compiler.d.ts +39 -0
  15. package/dist/Compiler.d.ts.map +1 -0
  16. package/dist/Compiler.js +48 -0
  17. package/dist/Compiler.js.map +1 -0
  18. package/dist/Encoding.d.ts +29 -46
  19. package/dist/Encoding.d.ts.map +1 -1
  20. package/dist/Encoding.js +76 -75
  21. package/dist/Encoding.js.map +1 -1
  22. package/dist/Expression.d.ts +15 -49
  23. package/dist/Expression.d.ts.map +1 -1
  24. package/dist/Expression.js +143 -131
  25. package/dist/Expression.js.map +1 -1
  26. package/dist/Input.d.ts +206 -177
  27. package/dist/Input.d.ts.map +1 -1
  28. package/dist/Input.js +317 -299
  29. package/dist/Input.js.map +1 -1
  30. package/dist/Nom.d.ts +44 -84
  31. package/dist/Nom.d.ts.map +1 -1
  32. package/dist/Nom.js +423 -453
  33. package/dist/Nom.js.map +1 -1
  34. package/dist/ParseError.d.ts +54 -49
  35. package/dist/ParseError.d.ts.map +1 -1
  36. package/dist/ParseError.js +233 -275
  37. package/dist/ParseError.js.map +1 -1
  38. package/dist/Parser.d.ts +345 -313
  39. package/dist/Parser.d.ts.map +1 -1
  40. package/dist/Parser.js +2010 -1802
  41. package/dist/Parser.js.map +1 -1
  42. package/dist/ParserSchema.d.ts +8 -7
  43. package/dist/ParserSchema.d.ts.map +1 -1
  44. package/dist/ParserSchema.js +49 -49
  45. package/dist/ParserSchema.js.map +1 -1
  46. package/dist/ParserStream.d.ts +26 -20
  47. package/dist/ParserStream.d.ts.map +1 -1
  48. package/dist/ParserStream.js +267 -255
  49. package/dist/ParserStream.js.map +1 -1
  50. package/dist/Syntax.d.ts +401 -0
  51. package/dist/Syntax.d.ts.map +1 -0
  52. package/dist/Syntax.js +717 -0
  53. package/dist/Syntax.js.map +1 -0
  54. package/dist/Text.d.ts +98 -134
  55. package/dist/Text.d.ts.map +1 -1
  56. package/dist/Text.js +534 -496
  57. package/dist/Text.js.map +1 -1
  58. package/dist/Token.d.ts +60 -42
  59. package/dist/Token.d.ts.map +1 -1
  60. package/dist/Token.js +331 -265
  61. package/dist/Token.js.map +1 -1
  62. package/dist/index.d.ts +16 -17
  63. package/dist/index.js +16 -17
  64. package/dist/internal/compiler/closure.d.ts +14 -16
  65. package/dist/internal/compiler/closure.d.ts.map +1 -1
  66. package/dist/internal/compiler/closure.js +1458 -1637
  67. package/dist/internal/compiler/closure.js.map +1 -1
  68. package/dist/internal/compiler/entries.d.ts +11 -11
  69. package/dist/internal/compiler/entries.d.ts.map +1 -1
  70. package/dist/internal/compiler/entries.js +36 -26
  71. package/dist/internal/compiler/entries.js.map +1 -1
  72. package/dist/internal/compiler/first.d.ts +19 -19
  73. package/dist/internal/compiler/first.d.ts.map +1 -1
  74. package/dist/internal/compiler/first.js +251 -227
  75. package/dist/internal/compiler/first.js.map +1 -1
  76. package/dist/internal/compiler/jit.d.ts +6 -17
  77. package/dist/internal/compiler/jit.d.ts.map +1 -1
  78. package/dist/internal/compiler/jit.js +860 -988
  79. package/dist/internal/compiler/jit.js.map +1 -1
  80. package/dist/internal/compiler/registry.d.ts +20 -21
  81. package/dist/internal/compiler/registry.d.ts.map +1 -1
  82. package/dist/internal/compiler/registry.js +21 -41
  83. package/dist/internal/compiler/registry.js.map +1 -1
  84. package/dist/internal/compiler/sets.d.ts +9 -13
  85. package/dist/internal/compiler/sets.d.ts.map +1 -1
  86. package/dist/internal/compiler/sets.js +76 -73
  87. package/dist/internal/compiler/sets.js.map +1 -1
  88. package/dist/internal/entries.d.ts +3 -3
  89. package/dist/internal/entries.d.ts.map +1 -1
  90. package/dist/internal/entries.js +38 -30
  91. package/dist/internal/entries.js.map +1 -1
  92. package/dist/internal/node.d.ts +177 -173
  93. package/dist/internal/node.d.ts.map +1 -1
  94. package/dist/internal/node.js +77 -66
  95. package/dist/internal/node.js.map +1 -1
  96. package/dist/internal/numbers.d.ts +7 -8
  97. package/dist/internal/numbers.d.ts.map +1 -1
  98. package/dist/internal/numbers.js +246 -276
  99. package/dist/internal/numbers.js.map +1 -1
  100. package/dist/internal/resume.d.ts +6 -24
  101. package/dist/internal/resume.d.ts.map +1 -1
  102. package/dist/internal/resume.js +30 -29
  103. package/dist/internal/resume.js.map +1 -1
  104. package/dist/internal/run.d.ts +15 -0
  105. package/dist/internal/run.d.ts.map +1 -0
  106. package/dist/internal/run.js +36 -0
  107. package/dist/internal/run.js.map +1 -0
  108. package/dist/internal/stack.d.ts +16 -0
  109. package/dist/internal/stack.d.ts.map +1 -0
  110. package/dist/internal/stack.js +26 -0
  111. package/dist/internal/stack.js.map +1 -0
  112. package/dist/internal/syntax.d.ts +146 -0
  113. package/dist/internal/syntax.d.ts.map +1 -0
  114. package/dist/internal/syntax.js +305 -0
  115. package/dist/internal/syntax.js.map +1 -0
  116. package/dist/internal/text.d.ts +10 -2
  117. package/dist/internal/text.d.ts.map +1 -1
  118. package/dist/internal/text.js +295 -345
  119. package/dist/internal/text.js.map +1 -1
  120. package/dist/internal/tokens.d.ts +25 -30
  121. package/dist/internal/tokens.d.ts.map +1 -1
  122. package/dist/internal/tokens.js +369 -363
  123. package/dist/internal/tokens.js.map +1 -1
  124. package/package.json +42 -28
  125. package/src/Ascii.ts +278 -187
  126. package/src/Binary.ts +150 -44
  127. package/src/Bits.ts +6 -3
  128. package/src/Compiler.ts +98 -0
  129. package/src/Expression.ts +10 -5
  130. package/src/Input.ts +106 -28
  131. package/src/Nom.ts +4 -3
  132. package/src/ParseError.ts +48 -51
  133. package/src/Parser.ts +1163 -795
  134. package/src/ParserStream.ts +104 -80
  135. package/src/Syntax.ts +900 -0
  136. package/src/Text.ts +272 -187
  137. package/src/Token.ts +180 -87
  138. package/src/index.ts +2 -0
  139. package/src/internal/compiler/closure.ts +121 -88
  140. package/src/internal/compiler/entries.ts +21 -8
  141. package/src/internal/compiler/first.ts +17 -15
  142. package/src/internal/compiler/jit.ts +360 -157
  143. package/src/internal/compiler/registry.ts +12 -33
  144. package/src/internal/compiler/sets.ts +17 -11
  145. package/src/internal/entries.ts +4 -2
  146. package/src/internal/node.ts +51 -37
  147. package/src/internal/numbers.ts +22 -20
  148. package/src/internal/resume.ts +8 -4
  149. package/src/internal/run.ts +41 -0
  150. package/src/internal/stack.ts +36 -0
  151. package/src/internal/syntax.ts +421 -0
  152. package/src/internal/text.ts +32 -25
  153. package/src/internal/tokens.ts +96 -51
  154. package/dist/index.d.ts.map +0 -1
  155. package/dist/index.js.map +0 -1
package/dist/Nom.js CHANGED
@@ -1,519 +1,489 @@
1
- /**
2
- * nom-flavoured names for effect-parse's parsers and combinators.
3
- *
4
- * effect-parse's main API follows winnow's naming (in camelCase). This module
5
- * offers the names, and argument orders, that nom users know, so grammars
6
- * can be ported with minimal changes:
7
- *
8
- * | nom | effect-parse |
9
- * |---|---|
10
- * | `tag("abc")` | `Token.literal("abc")` |
11
- * | `many0(p)` | `Parser.repeat(p)` |
12
- * | `separated_list1(sep, p)` | `Parser.separated(p, sep, { min: 1 })` |
13
- * | `map_res(p, f)` | `Parser.tryMap(p, f)` |
14
- * | `recognize(p)` | `Parser.taken(p)` |
15
- * | `value(v, p)` | `Parser.as(p, v)` |
16
- *
17
- * nom's `streaming` and `complete` variants are not separate functions here.
18
- * Whether input is partial is decided by the runner (`Parser.parsePartial`
19
- * vs `Parser.parse`).
20
- *
21
- * @example
22
- * ```ts
23
- * import { Result } from "effect"
24
- * import { Nom, Parser } from "@thomasfosterau/effect-parse"
25
- *
26
- * const hexPrimary = Nom.mapRes(
27
- * Nom.takeWhileMN(2, 2, (c: string) => /[0-9a-fA-F]/.test(c)),
28
- * (s) => Result.succeed(parseInt(s, 16))
29
- * )
30
- * const hexColor = Nom.preceded(
31
- * Nom.tag("#"),
32
- * Nom.tuple(hexPrimary, hexPrimary, hexPrimary)
33
- * )
34
- *
35
- * Parser.parse(hexColor, "#2F14DF") // Result.succeed([47, 20, 223])
36
- * ```
37
- *
38
- * @since 0.1.0
39
- */
40
- import * as Option from "effect/Option";
41
- import * as Result from "effect/Result";
42
- import * as Ascii from "./Ascii.js";
43
- import * as Binary from "./Binary.js";
1
+ import "effect/Result";
44
2
  import * as P from "./Parser.js";
45
3
  import * as Token from "./Token.js";
46
- // -----------------------------------------------------------------------------
47
- // bytes / character
48
- // -----------------------------------------------------------------------------
49
- /**
50
- * Matches a literal (nom's `tag`).
51
- *
52
- * @since 0.1.0
53
- * @category bytes
54
- */
55
- export const tag = Token.literal;
56
- /**
57
- * Matches a literal, ignoring ASCII case (nom's `tag_no_case`).
58
- *
59
- * @since 0.1.0
60
- * @category bytes
61
- */
62
- export const tagNoCase = Ascii.caseless;
63
- /**
64
- * Matches a single character (nom's `char`).
65
- *
66
- * @since 0.1.0
67
- * @category character
68
- */
69
- export const char = (c) => Token.literal(c);
70
- /**
71
- * Matches any character (nom's `anychar`).
72
- *
73
- * @since 0.1.0
74
- * @category character
75
- */
76
- export const anychar = Token.any;
77
- /**
78
- * @since 0.1.0
79
- * @category character
80
- */
81
- export const oneOf = Token.oneOf;
82
- /**
83
- * @since 0.1.0
84
- * @category character
85
- */
86
- export const noneOf = Token.noneOf;
87
- /**
88
- * @since 0.1.0
89
- * @category character
90
- */
91
- export const satisfy = Token.satisfy;
92
- /**
93
- * The longest non-empty run of tokens from a set (nom's `is_a`).
94
- *
95
- * @since 0.1.0
96
- * @category bytes
97
- */
98
- export const isA = (set) => Token.takeWhile(set, { min: 1 });
99
- /**
100
- * The longest non-empty run of tokens *not* from a set (nom's `is_not`).
101
- *
102
- * @since 0.1.0
103
- * @category bytes
104
- */
105
- export const isNot = (set) => Token.takeTill(set, { min: 1 });
106
- /**
107
- * @since 0.1.0
108
- * @category bytes
109
- */
110
- export const take = Token.take;
111
- /**
112
- * @since 0.1.0
113
- * @category bytes
114
- */
115
- export const takeWhile = (predicate) => Token.takeWhile(predicate);
116
- /**
117
- * @since 0.1.0
118
- * @category bytes
119
- */
120
- export const takeWhile1 = (predicate) => Token.takeWhile(predicate, { min: 1 });
121
- /**
122
- * @since 0.1.0
123
- * @category bytes
124
- */
125
- export const takeWhileMN = (m, n, predicate) => Token.takeWhile(predicate, { min: m, max: n });
126
- /**
127
- * @since 0.1.0
128
- * @category bytes
129
- */
130
- export const takeTill = (predicate) => Token.takeTill(predicate);
131
- /**
132
- * @since 0.1.0
133
- * @category bytes
134
- */
135
- export const takeTill1 = (predicate) => Token.takeTill(predicate, { min: 1 });
136
- /**
137
- * @since 0.1.0
138
- * @category bytes
139
- */
140
- export const takeUntil = Token.takeUntil;
141
- /**
142
- * Recognizes an escaped string (nom's `escaped`).
143
- *
144
- * @since 0.1.0
145
- * @category bytes
146
- */
147
- export const escaped = Ascii.takeEscaped;
148
- /**
149
- * Unescapes an escaped string (nom's `escaped_transform`).
150
- *
151
- * @since 0.1.0
152
- * @category bytes
153
- */
154
- export const escapedTransform = Ascii.escaped;
4
+ import "effect/Option";
5
+ import * as Ascii from "./Ascii.js";
6
+ import * as Binary from "./Binary.js";
7
+ //#region src/Nom.ts
8
+ /**
9
+ * Matches a literal (nom's `tag`).
10
+ *
11
+ * @since 0.1.0
12
+ * @category bytes
13
+ */
14
+ const tag = Token.literal;
15
+ /**
16
+ * Matches a literal, ignoring ASCII case (nom's `tag_no_case`).
17
+ *
18
+ * @since 0.1.0
19
+ * @category bytes
20
+ */
21
+ const tagNoCase = Ascii.caseless;
22
+ /**
23
+ * Matches a single character (nom's `char`).
24
+ *
25
+ * @since 0.1.0
26
+ * @category character
27
+ */
28
+ const char = (c) => Token.literal(c);
29
+ /**
30
+ * Matches any character (nom's `anychar`).
31
+ *
32
+ * @since 0.1.0
33
+ * @category character
34
+ */
35
+ const anychar = Token.any;
36
+ /**
37
+ * @since 0.1.0
38
+ * @category character
39
+ */
40
+ const oneOf = Token.oneOf;
41
+ /**
42
+ * @since 0.1.0
43
+ * @category character
44
+ */
45
+ const noneOf = Token.noneOf;
46
+ /**
47
+ * @since 0.1.0
48
+ * @category character
49
+ */
50
+ const satisfy = Token.satisfy;
51
+ /**
52
+ * The longest non-empty run of tokens from a set (nom's `is_a`).
53
+ *
54
+ * @since 0.1.0
55
+ * @category bytes
56
+ */
57
+ const isA = (set) => Token.takeWhile(set, { min: 1 });
58
+ /**
59
+ * The longest non-empty run of tokens *not* from a set (nom's `is_not`).
60
+ *
61
+ * @since 0.1.0
62
+ * @category bytes
63
+ */
64
+ const isNot = (set) => Token.takeTill(set, { min: 1 });
65
+ /**
66
+ * @since 0.1.0
67
+ * @category bytes
68
+ */
69
+ const take = Token.take;
70
+ /**
71
+ * @since 0.1.0
72
+ * @category bytes
73
+ */
74
+ const takeWhile = (predicate) => Token.takeWhile(predicate);
75
+ /**
76
+ * @since 0.1.0
77
+ * @category bytes
78
+ */
79
+ const takeWhile1 = (predicate) => Token.takeWhile(predicate, { min: 1 });
80
+ /**
81
+ * @since 0.1.0
82
+ * @category bytes
83
+ */
84
+ const takeWhileMN = (m, n, predicate) => Token.takeWhile(predicate, {
85
+ min: m,
86
+ max: n
87
+ });
88
+ /**
89
+ * @since 0.1.0
90
+ * @category bytes
91
+ */
92
+ const takeTill = (predicate) => Token.takeTill(predicate);
93
+ /**
94
+ * @since 0.1.0
95
+ * @category bytes
96
+ */
97
+ const takeTill1 = (predicate) => Token.takeTill(predicate, { min: 1 });
98
+ /**
99
+ * @since 0.1.0
100
+ * @category bytes
101
+ */
102
+ const takeUntil = Token.takeUntil;
103
+ /**
104
+ * Recognizes an escaped string (nom's `escaped`).
105
+ *
106
+ * @since 0.1.0
107
+ * @category bytes
108
+ */
109
+ const escaped = Ascii.takeEscaped;
110
+ /**
111
+ * Unescapes an escaped string (nom's `escaped_transform`).
112
+ *
113
+ * @since 0.1.0
114
+ * @category bytes
115
+ */
116
+ const escapedTransform = Ascii.escaped;
155
117
  /** @since 0.1.0 @category character */
156
- export const alpha0 = Ascii.alpha0;
118
+ const alpha0 = Ascii.alpha0;
157
119
  /** @since 0.1.0 @category character */
158
- export const alpha1 = Ascii.alpha1;
120
+ const alpha1 = Ascii.alpha1;
159
121
  /** @since 0.1.0 @category character */
160
- export const digit0 = Ascii.digit0;
122
+ const digit0 = Ascii.digit0;
161
123
  /** @since 0.1.0 @category character */
162
- export const digit1 = Ascii.digit1;
124
+ const digit1 = Ascii.digit1;
163
125
  /** @since 0.1.0 @category character */
164
- export const hexDigit0 = Ascii.hexDigit0;
126
+ const hexDigit0 = Ascii.hexDigit0;
165
127
  /** @since 0.1.0 @category character */
166
- export const hexDigit1 = Ascii.hexDigit1;
128
+ const hexDigit1 = Ascii.hexDigit1;
167
129
  /** @since 0.1.0 @category character */
168
- export const octDigit0 = Ascii.octDigit0;
130
+ const octDigit0 = Ascii.octDigit0;
169
131
  /** @since 0.1.0 @category character */
170
- export const octDigit1 = Ascii.octDigit1;
132
+ const octDigit1 = Ascii.octDigit1;
171
133
  /** @since 0.1.0 @category character */
172
- export const alphanumeric0 = Ascii.alphanumeric0;
134
+ const alphanumeric0 = Ascii.alphanumeric0;
173
135
  /** @since 0.1.0 @category character */
174
- export const alphanumeric1 = Ascii.alphanumeric1;
136
+ const alphanumeric1 = Ascii.alphanumeric1;
175
137
  /** @since 0.1.0 @category character */
176
- export const space0 = Ascii.space0;
138
+ const space0 = Ascii.space0;
177
139
  /** @since 0.1.0 @category character */
178
- export const space1 = Ascii.space1;
140
+ const space1 = Ascii.space1;
179
141
  /** @since 0.1.0 @category character */
180
- export const multispace0 = Ascii.multispace0;
142
+ const multispace0 = Ascii.multispace0;
181
143
  /** @since 0.1.0 @category character */
182
- export const multispace1 = Ascii.multispace1;
144
+ const multispace1 = Ascii.multispace1;
183
145
  /** @since 0.1.0 @category character */
184
- export const lineEnding = Ascii.lineEnding;
146
+ const lineEnding = Ascii.lineEnding;
185
147
  /** @since 0.1.0 @category character */
186
- export const newline = Ascii.newline;
148
+ const newline = Ascii.newline;
187
149
  /** @since 0.1.0 @category character */
188
- export const tab = Ascii.tab;
150
+ const tab = Ascii.tab;
189
151
  /** @since 0.1.0 @category character */
190
- export const crlf = Ascii.crlf;
191
- /**
192
- * nom's `not_line_ending`.
193
- *
194
- * @since 0.1.0
195
- * @category character
196
- */
197
- export const notLineEnding = Ascii.tillLineEnding;
198
- /**
199
- * A decimal unsigned integer (nom's `character::complete::u64` and friends).
200
- *
201
- * @since 0.1.0
202
- * @category character
203
- */
204
- export const u64 = Ascii.decUint;
205
- /**
206
- * A decimal signed integer (nom's `character::complete::i64` and friends).
207
- *
208
- * @since 0.1.0
209
- * @category character
210
- */
211
- export const i64 = Ascii.decInt;
212
- // -----------------------------------------------------------------------------
213
- // number
214
- // -----------------------------------------------------------------------------
215
- /**
216
- * nom's `double` (and `float`).
217
- *
218
- * @since 0.1.0
219
- * @category number
220
- */
221
- export const double = Ascii.float;
222
- /**
223
- * nom's `recognize_float`.
224
- *
225
- * @since 0.1.0
226
- * @category number
227
- */
228
- export const recognizeFloat = P.taken(Ascii.float);
229
- /**
230
- * nom's `hex_u32`.
231
- *
232
- * @since 0.1.0
233
- * @category number
234
- */
235
- export const hexU32 = Ascii.hexUint;
152
+ const crlf = Ascii.crlf;
153
+ /**
154
+ * nom's `not_line_ending`.
155
+ *
156
+ * @since 0.1.0
157
+ * @category character
158
+ */
159
+ const notLineEnding = Ascii.tillLineEnding;
160
+ /**
161
+ * A decimal unsigned integer (nom's `character::complete::u64` and friends).
162
+ *
163
+ * @since 0.1.0
164
+ * @category character
165
+ */
166
+ const u64 = Ascii.decUint;
167
+ /**
168
+ * A decimal signed integer (nom's `character::complete::i64` and friends).
169
+ *
170
+ * @since 0.1.0
171
+ * @category character
172
+ */
173
+ const i64 = Ascii.decInt;
174
+ /**
175
+ * nom's `double` (and `float`).
176
+ *
177
+ * @since 0.1.0
178
+ * @category number
179
+ */
180
+ const double = Ascii.float;
181
+ /**
182
+ * nom's `recognize_float`.
183
+ *
184
+ * @since 0.1.0
185
+ * @category number
186
+ */
187
+ const recognizeFloat = /*#__PURE__*/ P.taken(Ascii.float);
188
+ /**
189
+ * nom's `hex_u32`.
190
+ *
191
+ * @since 0.1.0
192
+ * @category number
193
+ */
194
+ const hexU32 = Ascii.hexUint;
236
195
  /** @since 0.1.0 @category number */
237
- export const beU8 = Binary.u8;
196
+ const beU8 = Binary.u8;
238
197
  /** @since 0.1.0 @category number */
239
- export const beI8 = Binary.i8;
198
+ const beI8 = Binary.i8;
240
199
  /** @since 0.1.0 @category number */
241
- export const leU8 = Binary.u8;
200
+ const leU8 = Binary.u8;
242
201
  /** @since 0.1.0 @category number */
243
- export const leI8 = Binary.i8;
202
+ const leI8 = Binary.i8;
244
203
  /** @since 0.1.0 @category number */
245
- export const beU16 = Binary.beU16;
204
+ const beU16 = Binary.beU16;
246
205
  /** @since 0.1.0 @category number */
247
- export const leU16 = Binary.leU16;
206
+ const leU16 = Binary.leU16;
248
207
  /** @since 0.1.0 @category number */
249
- export const beI16 = Binary.beI16;
208
+ const beI16 = Binary.beI16;
250
209
  /** @since 0.1.0 @category number */
251
- export const leI16 = Binary.leI16;
210
+ const leI16 = Binary.leI16;
252
211
  /** @since 0.1.0 @category number */
253
- export const beU24 = Binary.beU24;
212
+ const beU24 = Binary.beU24;
254
213
  /** @since 0.1.0 @category number */
255
- export const leU24 = Binary.leU24;
214
+ const leU24 = Binary.leU24;
256
215
  /** @since 0.1.0 @category number */
257
- export const beI24 = Binary.beI24;
216
+ const beI24 = Binary.beI24;
258
217
  /** @since 0.1.0 @category number */
259
- export const leI24 = Binary.leI24;
218
+ const leI24 = Binary.leI24;
260
219
  /** @since 0.1.0 @category number */
261
- export const beU32 = Binary.beU32;
220
+ const beU32 = Binary.beU32;
262
221
  /** @since 0.1.0 @category number */
263
- export const leU32 = Binary.leU32;
222
+ const leU32 = Binary.leU32;
264
223
  /** @since 0.1.0 @category number */
265
- export const beI32 = Binary.beI32;
224
+ const beI32 = Binary.beI32;
266
225
  /** @since 0.1.0 @category number */
267
- export const leI32 = Binary.leI32;
226
+ const leI32 = Binary.leI32;
268
227
  /** @since 0.1.0 @category number */
269
- export const beU64 = Binary.beU64;
228
+ const beU64 = Binary.beU64;
270
229
  /** @since 0.1.0 @category number */
271
- export const leU64 = Binary.leU64;
230
+ const leU64 = Binary.leU64;
272
231
  /** @since 0.1.0 @category number */
273
- export const beI64 = Binary.beI64;
232
+ const beI64 = Binary.beI64;
274
233
  /** @since 0.1.0 @category number */
275
- export const leI64 = Binary.leI64;
234
+ const leI64 = Binary.leI64;
276
235
  /** @since 0.1.0 @category number */
277
- export const beU128 = Binary.beU128;
236
+ const beU128 = Binary.beU128;
278
237
  /** @since 0.1.0 @category number */
279
- export const leU128 = Binary.leU128;
238
+ const leU128 = Binary.leU128;
280
239
  /** @since 0.1.0 @category number */
281
- export const beI128 = Binary.beI128;
240
+ const beI128 = Binary.beI128;
282
241
  /** @since 0.1.0 @category number */
283
- export const leI128 = Binary.leI128;
242
+ const leI128 = Binary.leI128;
284
243
  /** @since 0.1.0 @category number */
285
- export const beF32 = Binary.beF32;
244
+ const beF32 = Binary.beF32;
286
245
  /** @since 0.1.0 @category number */
287
- export const leF32 = Binary.leF32;
246
+ const leF32 = Binary.leF32;
288
247
  /** @since 0.1.0 @category number */
289
- export const beF64 = Binary.beF64;
248
+ const beF64 = Binary.beF64;
290
249
  /** @since 0.1.0 @category number */
291
- export const leF64 = Binary.leF64;
292
- // -----------------------------------------------------------------------------
293
- // multi
294
- // -----------------------------------------------------------------------------
295
- /**
296
- * Zero or more (nom's `many0`).
297
- *
298
- * @since 0.1.0
299
- * @category multi
300
- */
301
- export const many0 = (parser) => P.repeat(parser);
302
- /**
303
- * One or more (nom's `many1`).
304
- *
305
- * @since 0.1.0
306
- * @category multi
307
- */
308
- export const many1 = (parser) => P.repeat(parser, { min: 1 });
309
- /**
310
- * Between `m` and `n` times (nom's `many_m_n`).
311
- *
312
- * @since 0.1.0
313
- * @category multi
314
- */
315
- export const manyMN = (m, n, parser) => P.repeat(parser, { min: m, max: n });
316
- /**
317
- * Exactly `count` times (nom's `count`).
318
- *
319
- * @since 0.1.0
320
- * @category multi
321
- */
322
- export const count = (parser, count) => P.repeat(parser, count);
323
- /**
324
- * Repeats `parser` until `end` succeeds (nom's `many_till`).
325
- *
326
- * @since 0.1.0
327
- * @category multi
328
- */
329
- export const manyTill = (parser, end) => P.repeatTill(parser, end);
330
- /**
331
- * Zero or more `parser` separated by `separator` (nom's `separated_list0`;
332
- * note the separator comes first).
333
- *
334
- * @since 0.1.0
335
- * @category multi
336
- */
337
- export const separatedList0 = (separator, parser) => P.separated(parser, separator);
338
- /**
339
- * One or more `parser` separated by `separator` (nom's `separated_list1`;
340
- * note the separator comes first).
341
- *
342
- * @since 0.1.0
343
- * @category multi
344
- */
345
- export const separatedList1 = (separator, parser) => P.separated(parser, separator, { min: 1 });
346
- /**
347
- * Folds zero or more (nom's `fold_many0`).
348
- *
349
- * @since 0.1.0
350
- * @category multi
351
- */
352
- export const foldMany0 = (parser, init, f) => P.fold(parser, { init, f });
353
- /**
354
- * Folds one or more (nom's `fold_many1`).
355
- *
356
- * @since 0.1.0
357
- * @category multi
358
- */
359
- export const foldMany1 = (parser, init, f) => P.fold(parser, { init, f, range: { min: 1 } });
360
- /**
361
- * Folds between `m` and `n` times (nom's `fold_many_m_n`).
362
- *
363
- * @since 0.1.0
364
- * @category multi
365
- */
366
- export const foldManyMN = (m, n, parser, init, f) => P.fold(parser, { init, f, range: { min: m, max: n } });
367
- /**
368
- * nom's `length_data`.
369
- *
370
- * @since 0.1.0
371
- * @category multi
372
- */
373
- export const lengthData = Binary.lengthTake;
374
- /**
375
- * nom's `length_value`.
376
- *
377
- * @since 0.1.0
378
- * @category multi
379
- */
380
- export const lengthValue = Binary.lengthAndThen;
381
- /**
382
- * nom's `length_count`.
383
- *
384
- * @since 0.1.0
385
- * @category multi
386
- */
387
- export const lengthCount = Binary.lengthRepeat;
388
- // -----------------------------------------------------------------------------
389
- // sequence / branch
390
- // -----------------------------------------------------------------------------
391
- /**
392
- * nom's `pair`.
393
- *
394
- * @since 0.1.0
395
- * @category sequence
396
- */
397
- export const pair = (first, second) => P.zip(first, second);
398
- /**
399
- * nom's tuples of parsers (`(a, b, c)`, formerly `tuple`).
400
- *
401
- * @since 0.1.0
402
- * @category sequence
403
- */
404
- export const tuple = P.seq;
250
+ const leF64 = Binary.leF64;
251
+ /**
252
+ * Zero or more (nom's `many0`).
253
+ *
254
+ * @since 0.1.0
255
+ * @category multi
256
+ */
257
+ const many0 = (parser) => P.repeat(parser);
258
+ /**
259
+ * One or more (nom's `many1`).
260
+ *
261
+ * @since 0.1.0
262
+ * @category multi
263
+ */
264
+ const many1 = (parser) => P.repeat(parser, { min: 1 });
265
+ /**
266
+ * Between `m` and `n` times (nom's `many_m_n`).
267
+ *
268
+ * @since 0.1.0
269
+ * @category multi
270
+ */
271
+ const manyMN = (m, n, parser) => P.repeat(parser, {
272
+ min: m,
273
+ max: n
274
+ });
275
+ /**
276
+ * Exactly `count` times (nom's `count`).
277
+ *
278
+ * @since 0.1.0
279
+ * @category multi
280
+ */
281
+ const count = (parser, count) => P.repeat(parser, count);
282
+ /**
283
+ * Repeats `parser` until `end` succeeds (nom's `many_till`).
284
+ *
285
+ * @since 0.1.0
286
+ * @category multi
287
+ */
288
+ const manyTill = (parser, end) => P.repeatTill(parser, end);
289
+ /**
290
+ * Zero or more `parser` separated by `separator` (nom's `separated_list0`;
291
+ * note the separator comes first).
292
+ *
293
+ * @since 0.1.0
294
+ * @category multi
295
+ */
296
+ const separatedList0 = (separator, parser) => P.separated(parser, separator);
297
+ /**
298
+ * One or more `parser` separated by `separator` (nom's `separated_list1`;
299
+ * note the separator comes first).
300
+ *
301
+ * @since 0.1.0
302
+ * @category multi
303
+ */
304
+ const separatedList1 = (separator, parser) => P.separated(parser, separator, { min: 1 });
305
+ /**
306
+ * Folds zero or more (nom's `fold_many0`).
307
+ *
308
+ * @since 0.1.0
309
+ * @category multi
310
+ */
311
+ const foldMany0 = (parser, init, f) => P.fold(parser, {
312
+ init,
313
+ f
314
+ });
315
+ /**
316
+ * Folds one or more (nom's `fold_many1`).
317
+ *
318
+ * @since 0.1.0
319
+ * @category multi
320
+ */
321
+ const foldMany1 = (parser, init, f) => P.fold(parser, {
322
+ init,
323
+ f,
324
+ range: { min: 1 }
325
+ });
326
+ /**
327
+ * Folds between `m` and `n` times (nom's `fold_many_m_n`).
328
+ *
329
+ * @since 0.1.0
330
+ * @category multi
331
+ */
332
+ const foldManyMN = (m, n, parser, init, f) => P.fold(parser, {
333
+ init,
334
+ f,
335
+ range: {
336
+ min: m,
337
+ max: n
338
+ }
339
+ });
340
+ /**
341
+ * nom's `length_data`.
342
+ *
343
+ * @since 0.1.0
344
+ * @category multi
345
+ */
346
+ const lengthData = Binary.lengthTake;
347
+ /**
348
+ * nom's `length_value`.
349
+ *
350
+ * @since 0.1.0
351
+ * @category multi
352
+ */
353
+ const lengthValue = Binary.lengthAndThen;
354
+ /**
355
+ * nom's `length_count`.
356
+ *
357
+ * @since 0.1.0
358
+ * @category multi
359
+ */
360
+ const lengthCount = Binary.lengthRepeat;
361
+ /**
362
+ * nom's `pair`.
363
+ *
364
+ * @since 0.1.0
365
+ * @category sequence
366
+ */
367
+ const pair = (first, second) => P.zip(first, second);
368
+ /**
369
+ * nom's tuples of parsers (`(a, b, c)`, formerly `tuple`).
370
+ *
371
+ * @since 0.1.0
372
+ * @category sequence
373
+ */
374
+ const tuple = P.seq;
405
375
  /** @since 0.1.0 @category sequence */
406
- export const preceded = P.preceded;
376
+ const preceded = P.preceded;
407
377
  /** @since 0.1.0 @category sequence */
408
- export const terminated = P.terminated;
378
+ const terminated = P.terminated;
409
379
  /** @since 0.1.0 @category sequence */
410
- export const delimited = P.delimited;
380
+ const delimited = P.delimited;
411
381
  /** @since 0.1.0 @category sequence */
412
- export const separatedPair = P.separatedPair;
382
+ const separatedPair = P.separatedPair;
413
383
  /** @since 0.1.0 @category branch */
414
- export const alt = P.alt;
384
+ const alt = P.alt;
415
385
  /** @since 0.1.0 @category branch */
416
- export const permutation = P.permutation;
417
- // -----------------------------------------------------------------------------
418
- // combinator
419
- // -----------------------------------------------------------------------------
420
- /**
421
- * nom's `map`.
422
- *
423
- * @since 0.1.0
424
- * @category combinator
425
- */
426
- export const map = (parser, f) => P.map(parser, f);
427
- /**
428
- * nom's `map_res`: the function returns a `Result`.
429
- *
430
- * @since 0.1.0
431
- * @category combinator
432
- */
433
- export const mapRes = (parser, f) => P.tryMap(parser, f);
434
- /**
435
- * nom's `map_opt`: the function returns an `Option`.
436
- *
437
- * @since 0.1.0
438
- * @category combinator
439
- */
440
- export const mapOpt = (parser, f) => P.filterMap(parser, f);
441
- /**
442
- * nom's `map_parser`.
443
- *
444
- * @since 0.1.0
445
- * @category combinator
446
- */
447
- export const mapParser = (parser, applied) => P.mapParser(parser, applied);
448
- /**
449
- * nom's `flat_map`.
450
- *
451
- * @since 0.1.0
452
- * @category combinator
453
- */
454
- export const flatMap = (parser, f) => P.flatMap(parser, f);
455
- /**
456
- * nom's `value` (note the value comes first).
457
- *
458
- * @since 0.1.0
459
- * @category combinator
460
- */
461
- export const value = (val, parser) => P.as(parser, val);
462
- /**
463
- * nom's `verify`.
464
- *
465
- * @since 0.1.0
466
- * @category combinator
467
- */
468
- export const verify = (parser, predicate) => P.filter(parser, predicate);
469
- /**
470
- * nom's `recognize`.
471
- *
472
- * @since 0.1.0
473
- * @category combinator
474
- */
475
- export const recognize = P.taken;
476
- /**
477
- * nom's `consumed`: returns `[consumed, output]`.
478
- *
479
- * @since 0.1.0
480
- * @category combinator
481
- */
482
- export const consumed = (parser) => P.map(P.withTaken(parser), ([a, s]) => [s, a]);
386
+ const permutation = P.permutation;
387
+ /**
388
+ * nom's `map`.
389
+ *
390
+ * @since 0.1.0
391
+ * @category combinator
392
+ */
393
+ const map = (parser, f) => P.map(parser, f);
394
+ /**
395
+ * nom's `map_res`: the function returns a `Result`.
396
+ *
397
+ * @since 0.1.0
398
+ * @category combinator
399
+ */
400
+ const mapRes = (parser, f) => P.tryMap(parser, f);
401
+ /**
402
+ * nom's `map_opt`: the function returns an `Option`.
403
+ *
404
+ * @since 0.1.0
405
+ * @category combinator
406
+ */
407
+ const mapOpt = (parser, f) => P.filterMap(parser, f);
408
+ /**
409
+ * nom's `map_parser`.
410
+ *
411
+ * @since 0.1.0
412
+ * @category combinator
413
+ */
414
+ const mapParser = (parser, applied) => P.mapParser(parser, applied);
415
+ /**
416
+ * nom's `flat_map`.
417
+ *
418
+ * @since 0.1.0
419
+ * @category combinator
420
+ */
421
+ const flatMap = (parser, f) => P.flatMap(parser, f);
422
+ /**
423
+ * nom's `value` (note the value comes first).
424
+ *
425
+ * @since 0.1.0
426
+ * @category combinator
427
+ */
428
+ const value = (val, parser) => P.as(parser, val);
429
+ /**
430
+ * nom's `verify`.
431
+ *
432
+ * @since 0.1.0
433
+ * @category combinator
434
+ */
435
+ const verify = (parser, predicate) => P.filter(parser, predicate);
436
+ /**
437
+ * nom's `recognize`.
438
+ *
439
+ * @since 0.1.0
440
+ * @category combinator
441
+ */
442
+ const recognize = P.taken;
443
+ /**
444
+ * nom's `consumed`: returns `[consumed, output]`.
445
+ *
446
+ * @since 0.1.0
447
+ * @category combinator
448
+ */
449
+ const consumed = (parser) => P.map(P.withTaken(parser), ([a, s]) => [s, a]);
483
450
  /** @since 0.1.0 @category combinator */
484
- export const opt = P.opt;
451
+ const opt = P.opt;
485
452
  /** @since 0.1.0 @category combinator */
486
- export const cond = P.cond;
453
+ const cond = P.cond;
487
454
  /** @since 0.1.0 @category combinator */
488
- export const peek = P.peek;
455
+ const peek = P.peek;
489
456
  /** @since 0.1.0 @category combinator */
490
- export const not = P.not;
457
+ const not = P.not;
491
458
  /** @since 0.1.0 @category combinator */
492
- export const eof = P.eof;
459
+ const eof = P.eof;
493
460
  /** @since 0.1.0 @category combinator */
494
- export const allConsuming = P.allConsuming;
461
+ const allConsuming = P.allConsuming;
495
462
  /** @since 0.1.0 @category combinator */
496
- export const complete = P.complete;
463
+ const complete = P.complete;
497
464
  /** @since 0.1.0 @category combinator */
498
- export const cut = P.cut;
465
+ const cut = P.cut;
499
466
  /** @since 0.1.0 @category combinator */
500
- export const success = P.succeed;
501
- /**
502
- * nom's `fail()`.
503
- *
504
- * @since 0.1.0
505
- * @category combinator
506
- */
507
- export const fail = P.reject;
467
+ const success = P.succeed;
468
+ /**
469
+ * nom's `fail()`.
470
+ *
471
+ * @since 0.1.0
472
+ * @category combinator
473
+ */
474
+ const fail = P.reject;
508
475
  /** @since 0.1.0 @category combinator */
509
- export const rest = Token.rest;
476
+ const rest = Token.rest;
510
477
  /** @since 0.1.0 @category combinator */
511
- export const restLen = Token.restLen;
512
- /**
513
- * nom's `context` (note the label comes first).
514
- *
515
- * @since 0.1.0
516
- * @category error
517
- */
518
- export const context = (label, parser) => P.context(parser, label);
478
+ const restLen = Token.restLen;
479
+ /**
480
+ * nom's `context` (note the label comes first).
481
+ *
482
+ * @since 0.1.0
483
+ * @category error
484
+ */
485
+ const context = (label, parser) => P.context(parser, label);
486
+ //#endregion
487
+ export { allConsuming, alpha0, alpha1, alphanumeric0, alphanumeric1, alt, anychar, beF32, beF64, beI128, beI16, beI24, beI32, beI64, beI8, beU128, beU16, beU24, beU32, beU64, beU8, char, complete, cond, consumed, context, count, crlf, cut, delimited, digit0, digit1, double, eof, escaped, escapedTransform, fail, flatMap, foldMany0, foldMany1, foldManyMN, hexDigit0, hexDigit1, hexU32, i64, isA, isNot, leF32, leF64, leI128, leI16, leI24, leI32, leI64, leI8, leU128, leU16, leU24, leU32, leU64, leU8, lengthCount, lengthData, lengthValue, lineEnding, many0, many1, manyMN, manyTill, map, mapOpt, mapParser, mapRes, multispace0, multispace1, newline, noneOf, not, notLineEnding, octDigit0, octDigit1, oneOf, opt, pair, peek, permutation, preceded, recognize, recognizeFloat, rest, restLen, satisfy, separatedList0, separatedList1, separatedPair, space0, space1, success, tab, tag, tagNoCase, take, takeTill, takeTill1, takeUntil, takeWhile, takeWhile1, takeWhileMN, terminated, tuple, u64, value, verify };
488
+
519
489
  //# sourceMappingURL=Nom.js.map