effect-grammar 0.1.0 → 0.3.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 (49) hide show
  1. package/README.md +170 -73
  2. package/dist/combinators.d.ts +66 -21
  3. package/dist/combinators.d.ts.map +1 -1
  4. package/dist/combinators.js +150 -47
  5. package/dist/combinators.js.map +1 -1
  6. package/dist/core.d.ts +111 -39
  7. package/dist/core.d.ts.map +1 -1
  8. package/dist/core.js +24 -20
  9. package/dist/core.js.map +1 -1
  10. package/dist/env.d.ts +20 -0
  11. package/dist/env.d.ts.map +1 -0
  12. package/dist/env.js +63 -0
  13. package/dist/env.js.map +1 -0
  14. package/dist/errors.d.ts +34 -1
  15. package/dist/errors.d.ts.map +1 -1
  16. package/dist/errors.js +37 -4
  17. package/dist/errors.js.map +1 -1
  18. package/dist/gen.d.ts +7 -0
  19. package/dist/gen.d.ts.map +1 -0
  20. package/dist/gen.js +200 -0
  21. package/dist/gen.js.map +1 -0
  22. package/dist/index.d.ts +4 -4
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +2 -2
  25. package/dist/index.js.map +1 -1
  26. package/dist/parse.d.ts.map +1 -1
  27. package/dist/parse.js +152 -114
  28. package/dist/parse.js.map +1 -1
  29. package/dist/pattern.d.ts +5 -0
  30. package/dist/pattern.d.ts.map +1 -0
  31. package/dist/pattern.js +46 -0
  32. package/dist/pattern.js.map +1 -0
  33. package/dist/print.d.ts +2 -1
  34. package/dist/print.d.ts.map +1 -1
  35. package/dist/print.js +201 -89
  36. package/dist/print.js.map +1 -1
  37. package/dist/recovery.d.ts +10 -0
  38. package/dist/recovery.d.ts.map +1 -0
  39. package/dist/recovery.js +296 -0
  40. package/dist/recovery.js.map +1 -0
  41. package/dist/render.d.ts +4 -4
  42. package/dist/render.d.ts.map +1 -1
  43. package/dist/render.js +133 -42
  44. package/dist/render.js.map +1 -1
  45. package/dist/schema.d.ts +1 -1
  46. package/dist/schema.d.ts.map +1 -1
  47. package/dist/schema.js +11 -4
  48. package/dist/schema.js.map +1 -1
  49. package/package.json +33 -17
package/README.md CHANGED
@@ -2,22 +2,29 @@
2
2
 
3
3
  Invertible grammar combinators and parser-printers for Effect.
4
4
 
5
- Schema models your structured data. `effect-grammar` models the text formats inside your strings: connection strings, duration strings (`1h30m`), cron expressions, search queries, or DSLs.
5
+ Schema models your structured data. `effect-grammar` models the text formats
6
+ inside your strings: connection strings, duration strings (`1h30m`), cron
7
+ expressions, search queries, or DSLs.
6
8
 
7
9
  You write the grammar definition once. You get four outputs:
8
10
 
9
- - **A Parser**: Reads text and outputs structured data with line and column error messages.
10
- - **A Printer**: Converts structured data back to canonical text.
11
- - **A `Schema.Codec<A, string>`**: Integrates directly with Effect Schema (`decode` parses, `encode` prints, and Schema refinements compose).
12
- - **A Text Renderer**: Formats the grammar as readable text for documentation and schema descriptions.
11
+ - **A parser.** Reads text and outputs structured data, with line and column
12
+ error messages.
13
+ - **A printer.** Converts structured data back to canonical text.
14
+ - **A `Schema.Codec<A, string>`.** Decoding parses, encoding prints, and Schema
15
+ refinements compose.
16
+ - **A text renderer.** Formats the grammar as readable text, for documentation
17
+ and schema descriptions.
13
18
 
14
19
  ## Why effect-grammar?
15
20
 
16
- - **`Schema.transformOrFail`**: Requires you to write and maintain both `decode` and `encode` functions manually.
17
- - **`Schema.TemplateLiteralParser`**: Supports only flat `${a}-${b}` string patterns.
18
- - **`effect-grammar`**: Automatically derives the parser and printer for formats with optional parts, repetition, alternation, and recursion.
21
+ `Schema.transformOrFail` makes you write and maintain both directions by hand.
22
+ `Schema.TemplateLiteralParser` only handles flat `${a}-${b}` patterns.
23
+ `effect-grammar` derives both directions for you. It handles optional parts,
24
+ repetition, alternation, recursion, and parts that depend on earlier parts.
19
25
 
20
- This is for format strings, not documents. The parser backtracks with no memoization and no left recursion. Printing is canonical, not pretty.
26
+ This is for format strings, not documents. The parser backtracks. There is no
27
+ memoization and no left recursion. Printing is canonical, not pretty.
21
28
 
22
29
  ## Install
23
30
 
@@ -25,105 +32,164 @@ This is for format strings, not documents. The parser backtracks with no memoiza
25
32
  pnpm add effect-grammar
26
33
  ```
27
34
 
28
- Depends on Effect v4. The package pins `effect` to `4.0.0-beta.102` for now.
35
+ Requires Effect `4.0.0-rc.112` or newer in the Effect 4 line.
29
36
 
30
37
  ## A grammar
31
38
 
32
39
  ```ts
33
- import { Schema } from "effect"
34
40
  import * as Grammar from "effect-grammar"
35
41
 
36
42
  const endpoint = Grammar.gen(function* () {
37
43
  yield* Grammar.literal("https://")
38
- const host = yield* Grammar.field("host", Grammar.regex(/[^:/?#]+/, "host"))
39
- const port = yield* Grammar.field(
40
- "port",
41
- Grammar.optional(Grammar.prefix(":", Grammar.integer)),
42
- )
43
- return { host, port: port ?? 443 }
44
+ const host = yield* Grammar.regex(/[^:/?#]+/, "host")
45
+ const port = yield* Grammar.optional(Grammar.prefix(":", Grammar.integer))
46
+ return { host, port }
44
47
  })
45
48
 
46
49
  Grammar.parse(endpoint, "https://effect.website:8080")
47
50
  // Result.succeed({ host: "effect.website", port: 8080 })
51
+
48
52
  Grammar.parse(endpoint, "https://effect.website:abc")
49
53
  // Result.fail(ParseError: line 1, column 24: expected integer, found "a")
54
+
50
55
  Grammar.print(endpoint, { host: "effect.website", port: 443 })
51
56
  // Result.succeed("https://effect.website:443")
57
+
52
58
  Grammar.render(endpoint)
53
59
  // "https://" host:<host> port:(":" <integer>)?
54
60
  ```
55
61
 
56
- A silent grammar (`literal`, `symbol`, `whitespace`, anything under `skip`)
57
- carries no value and can be `yield*`-ed bare. A value grammar goes through
58
- `field(name, g)`.
62
+ `gen` runs the generator once, when you build the grammar. Nothing is parsed
63
+ yet.
64
+
65
+ Inside the generator, `yield*` on a value grammar does not give you a value. It
66
+ gives you a `Ref<A>`: a stand-in for the value that will exist at parse and
67
+ print time. `yield*` on a silent grammar, such as `literal` or `symbol`, gives
68
+ nothing back. Silent grammars carry no value.
69
+
70
+ The generator's return value is a pattern over those refs. It can be a bare ref,
71
+ an object, an array, or constants around them. Parsing fills the pattern in.
72
+ Printing reads each ref back out of the value you hand it. That is what makes
73
+ the grammar invertible.
74
+
75
+ ```ts
76
+ const nested = Grammar.gen(function* () {
77
+ const host = yield* Grammar.regex(/[^:]+/, "host")
78
+ yield* Grammar.literal(":")
79
+ const port = yield* Grammar.integer
80
+ return { kind: "endpoint", address: { host, port } } as const
81
+ })
82
+ // Grammar<{ kind: "endpoint"; address: { host: string; port: number } }>
83
+ ```
84
+
85
+ ## The one rule
59
86
 
60
- `print` replays the generator. It reads each field from `value[name]` and
61
- passes that back as the `yield*` result. An `if` on a parsed value takes the
62
- same path both ways. The generator's return must hold every field under its
63
- name, and the types enforce it. Return nothing and you get the object of fields.
87
+ Every binding must appear in the return pattern exactly once. `gen` throws at
88
+ build time if one does not. A binding the return does not hold is a value the
89
+ printer could not print.
64
90
 
65
- `render` cannot read a generator. It runs the generator once with no values and
66
- shows the parts it yields. The rendering is exact when the generator is
67
- straight-line, as above. If the generator branches on a parsed value, render
68
- still runs with no values. `if (kind === "a") yield* ...` shows only the path
69
- `undefined` takes, with no warning. Put the branch in `choice` instead, which
70
- renders every option.
91
+ To parse something and then drop it, wrap it with `skip`. The grammar prints its
92
+ canonical form instead.
71
93
 
72
- `seq` is the same field object without generator control flow. It renders every
73
- part:
94
+ ## Refs are not values
95
+
96
+ A ref is a stand-in, so JavaScript cannot look inside it. Comparing a ref with
97
+ `===` is a type error. Interpolating one into a string throws.
98
+
99
+ Branching on a ref is `match`, described below. For everything else there are
100
+ small helpers: `defaulted` supplies a value when a part is absent.
101
+ `get(ref, key)` reads a property of a ref, including reserved names such as
102
+ `then` and `toJSON`.
103
+
104
+ ## Depending on an earlier part
105
+
106
+ `match` picks a grammar based on an earlier binding. The printer runs the same
107
+ choice backwards.
74
108
 
75
109
  ```ts
76
- const member = Grammar.seq(
77
- Grammar.field("key", jsonString),
78
- Grammar.symbol(":"),
79
- Grammar.field("value", jsonValue),
80
- )
81
- // Grammar<{ key: string; value: Json }>
110
+ const tagged = Grammar.gen(function* () {
111
+ const kind = yield* Grammar.choice(
112
+ Grammar.literal("n:").pipe(Grammar.as("num")),
113
+ Grammar.literal("w:").pipe(Grammar.as("word")),
114
+ )
115
+ const value = yield* Grammar.match(kind, {
116
+ num: Grammar.integer,
117
+ word: Grammar.regex(/[a-z]+/, "word"),
118
+ })
119
+ return { kind, value }
120
+ })
121
+ // parses "n:12" → { kind: "num", value: 12 }
82
122
  ```
83
123
 
84
- ## The Schema
124
+ `match` requires the cases to cover every literal of the selector's type.
125
+ `matchValue` is the same idea with number or mixed literal keys. Keys keep their
126
+ type, so `1` and `"1"` are distinct cases.
85
127
 
86
- `toSchema` takes the grammar and the Schema it should decode to. Parsing happens
87
- first, then the target's refinements. Encoding prints.
128
+ A property of a ref is a ref to that property. A header parsed by one grammar
129
+ can steer the body of another:
88
130
 
89
131
  ```ts
90
- const Endpoint = Grammar.toSchema(
91
- endpoint,
92
- Schema.Struct({
93
- host: Schema.NonEmptyString,
94
- port: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 65535 })),
95
- }),
96
- { identifier: "Endpoint" },
97
- )
132
+ const frame = Grammar.gen(function* () {
133
+ const header = yield* headerGrammar // { kind: "text" | "bin"; size: number }
134
+ yield* Grammar.literal(":")
135
+ const body = yield* Grammar.match(header.kind, {
136
+ text: Grammar.take(header.size),
137
+ bin: Grammar.repeat(Grammar.regex(/[01]/, "bit"), header.size),
138
+ })
139
+ return { header, body }
140
+ })
141
+ ```
142
+
143
+ `take(n)` reads exactly `n` characters (UTF-16 code units). `repeat(g, n)` reads
144
+ exactly `n` repetitions. The count is a value like any other: return it, and
145
+ printing reads it back. A netstring is:
98
146
 
99
- Schema.decodeUnknownSync(Endpoint)("https://effect.website:443")
100
- // { host: "effect.website", port: 443 }
101
- Schema.encodeSync(Endpoint)({ host: "effect.website", port: 443 })
102
- // "https://effect.website:443"
147
+ ```ts
148
+ const netstring = Grammar.gen(function* () {
149
+ const length = yield* Grammar.integer
150
+ yield* Grammar.literal(":")
151
+ const payload = yield* Grammar.take(length)
152
+ yield* Grammar.literal(",")
153
+ return { length, payload }
154
+ })
155
+ // "5:hello," ⇄ { length: 5, payload: "hello" }
103
156
  ```
104
157
 
158
+ `seq(...silents)` builds a silent sequence.
159
+
105
160
  ## Values and alternatives
106
161
 
107
- `transform` maps a value both ways. `decodeTo` takes a Schema that types
108
- `decode` and `encode` and checks the value on parse and on print. A `choice`
109
- of Schema-typed branches picks the matching Schema when printing.
162
+ `transform` maps between two types, in both directions. Write plain functions.
163
+ If a callback throws, the grammar fails cleanly. Use `transformOrFail` when a
164
+ direction should return a `Result` instead:
110
165
 
111
166
  ```ts
112
- const Num = Schema.Struct({ kind: Schema.Literal("num"), value: Schema.Finite })
113
- const num = Grammar.integer.pipe(
114
- Grammar.decodeTo(Num)({
115
- decode: (value) => ({ kind: "num", value }),
116
- encode: (n) => n.value,
167
+ const jsonString = Grammar.regex(/"(?:[^"\\]|\\.)*"/, "string").pipe(
168
+ Grammar.transformOrFail({
169
+ decode: (text) =>
170
+ Result.try({
171
+ try: () => JSON.parse(text),
172
+ catch: (error) => ({ message: String(error) }),
173
+ }),
174
+ encode: (value) => Result.succeed(JSON.stringify(value)),
117
175
  }),
118
176
  )
119
177
  ```
120
178
 
121
- `as` turns a silent grammar into a constant. `flag` turns presence into a
122
- boolean:
179
+ `decodeTo` checks the value against a Schema on parse and on print. `as` turns a
180
+ silent grammar into a constant. `flag` turns presence into a boolean.
181
+
182
+ `choice` tries its options in order and backtracks. It has one round-trip rule:
183
+ the text printed for a branch must not parse as a different value through an
184
+ earlier branch. `taggedChoice` records the chosen branch in the result.
123
185
 
124
186
  ```ts
125
- const jsonNull = Grammar.symbol("null").pipe(Grammar.as(null))
126
- const negate = Grammar.flag("-")
187
+ const value = Grammar.taggedChoice("kind", {
188
+ number: Grammar.integer,
189
+ word: Grammar.regex(/[a-z]+/, "word"),
190
+ })
191
+ // parses "12" → { kind: "number", value: 12 }
192
+ // prints the same → "12"
127
193
  ```
128
194
 
129
195
  Recursion uses `suspend`:
@@ -143,16 +209,47 @@ const jsonValue: Grammar.Grammar<Json> = Grammar.suspend(
143
209
  )
144
210
  ```
145
211
 
146
- See `examples/` for JSON, Scheme, a Postgres DSN, netstrings, and GitHub's
147
- search syntax.
212
+ See `examples/` for JSON, Scheme, a Postgres DSN, netstrings, a wire protocol,
213
+ and GitHub's search syntax.
148
214
 
149
- ## Errors
215
+ ## Products, delimiters, and trivia
150
216
 
151
- `choice` backtracks. Errors report the furthest position the parser reached and
152
- everything that could have matched there:
217
+ `struct` and `tuple` build products without a generator. Their staged form is
218
+ the same as what `gen` builds.
153
219
 
220
+ Delimiter combinators work data-first and data-last:
221
+
222
+ ```ts
223
+ const port = Grammar.integer.pipe(
224
+ Grammar.prefix(":"),
225
+ Grammar.optional(),
226
+ Grammar.defaulted(443),
227
+ )
228
+
229
+ const pair = Grammar.tuple(
230
+ Grammar.integer,
231
+ Grammar.integer.pipe(Grammar.prefix(",")),
232
+ )
154
233
  ```
155
- line 1, column 7: expected one of "null", "true", "false", number, string, "[", "{", found end of input
156
- ```
157
234
 
158
- `label(name)` names a grammar for these messages.
235
+ `between` is the two-sided delimiter. `wrap` is another name for it. `lexeme`
236
+ skips trailing whitespace after a token, and prints none. `symbol` is a literal
237
+ lexeme. `space` is one exact space. `spaces` accepts one or more whitespace
238
+ characters and prints one canonical space.
239
+
240
+ ## Rendering
241
+
242
+ `render` formats a grammar as readable text, including binding paths. `describe`
243
+ returns a short name for a grammar.
244
+
245
+ The interpreter AST is private. Public grammars expose only `Grammar<A>`,
246
+ `Ref<A>`, and the combinators.
247
+
248
+ ## Errors
249
+
250
+ Parse errors report the furthest position reached, with every expected form at
251
+ that position, plus line and column.
252
+
253
+ Print errors carry a `PrintIssue` tree. It records structural paths, missing
254
+ fields, branch failures, and value mismatches. `PrintError.format` renders the
255
+ tree as text.
@@ -1,20 +1,23 @@
1
- import { Schema } from "effect";
2
- import { type Field, type Fields, type Grammar, type Silent, type Type } from "./core.ts";
3
- export { field } from "./core.ts";
1
+ import { Result, Schema } from "effect";
2
+ import { type Grammar, type GrammarInternal, type GrammarIssue, type MatchKey, type Ref, type Silent, type Type } from "./core.ts";
3
+ export { gen, type GenGrammar, get, seq } from "./gen.ts";
4
4
  export declare const literal: (value: string) => Silent;
5
5
  export declare const empty: Silent;
6
- /** The regex is made sticky so the parser can match at a position without slicing. */
7
- export declare const regex: (re: RegExp, name: string) => Grammar<string>;
8
- export declare function seq(...parts: ReadonlyArray<Silent>): Silent;
9
- export declare function seq<const Parts extends ReadonlyArray<Silent | Field<string, any>>>(...parts: Parts): Grammar<Fields<Parts[number]>>;
10
- export declare const gen: <Y extends Silent | Field<string, any>, R extends Fields<Y> | void = void>(run: () => Generator<Y, R, any>) => Grammar<[R] extends [void] ? Fields<Y> : R>;
11
- export declare function wrap(open: Silent | string, inner: Silent, close: Silent | string): Silent;
12
- export declare function wrap<A>(open: Silent | string, inner: Grammar<A>, close: Silent | string): Grammar<A>;
6
+ export declare const regex: (expression: RegExp, name: string) => Grammar<string>;
7
+ type PreserveGrammar<G extends GrammarInternal> = G extends Silent ? Silent : G extends Grammar<infer A> ? Grammar<A> : never;
8
+ type OptionalGrammar<G extends GrammarInternal> = G extends Silent ? Silent : G extends Grammar<infer A> ? Grammar<A | undefined> : never;
9
+ export declare function between(open: Silent | string, close: Silent | string): <G extends GrammarInternal>(inner: G) => PreserveGrammar<G>;
10
+ export declare function between(open: Silent | string, inner: Silent, close: Silent | string): Silent;
11
+ export declare function between<A>(open: Silent | string, inner: Grammar<A>, close: Silent | string): Grammar<A>;
12
+ export declare const wrap: typeof between;
13
+ export declare function prefix(open: Silent | string): <G extends GrammarInternal>(inner: G) => PreserveGrammar<G>;
13
14
  export declare function prefix(open: Silent | string, inner: Silent): Silent;
14
15
  export declare function prefix<A>(open: Silent | string, inner: Grammar<A>): Grammar<A>;
16
+ export declare function suffix(close: Silent | string): <G extends GrammarInternal>(inner: G) => PreserveGrammar<G>;
15
17
  export declare function suffix(inner: Silent, close: Silent | string): Silent;
16
18
  export declare function suffix<A>(inner: Grammar<A>, close: Silent | string): Grammar<A>;
17
- export declare const choice: <const Gs extends readonly [Grammar<any>, ...Array<Grammar<any>>]>(...options: Gs) => Grammar<Type<Gs[number]>>;
19
+ export declare const choice: <const Grammars extends readonly [GrammarInternal, ...Array<GrammarInternal>]>(...options: Grammars) => Grammar<Type<Grammars[number]>>;
20
+ export declare function optional(): <G extends GrammarInternal>(inner: G) => OptionalGrammar<G>;
18
21
  export declare function optional(inner: Silent): Silent;
19
22
  export declare function optional<A>(inner: Grammar<A>): Grammar<A | undefined>;
20
23
  export interface RepeatOptions {
@@ -22,12 +25,23 @@ export interface RepeatOptions {
22
25
  readonly max?: number;
23
26
  }
24
27
  export declare const many: {
25
- <A>(inner: Grammar<A>, opts?: RepeatOptions): Grammar<ReadonlyArray<A>>;
26
- (opts?: RepeatOptions): <A>(inner: Grammar<A>) => Grammar<ReadonlyArray<A>>;
28
+ <A>(inner: Grammar<A>, options?: RepeatOptions): Grammar<ReadonlyArray<A>>;
29
+ (options?: RepeatOptions): <A>(inner: Grammar<A>) => Grammar<ReadonlyArray<A>>;
27
30
  };
28
31
  export declare const sepBy: {
29
- <A>(inner: Grammar<A>, sep: Silent | string, opts?: RepeatOptions): Grammar<ReadonlyArray<A>>;
30
- (sep: Silent | string, opts?: RepeatOptions): <A>(inner: Grammar<A>) => Grammar<ReadonlyArray<A>>;
32
+ <A>(inner: Grammar<A>, separator: Silent | string, options?: RepeatOptions): Grammar<ReadonlyArray<A>>;
33
+ (separator: Silent | string, options?: RepeatOptions): <A>(inner: Grammar<A>) => Grammar<ReadonlyArray<A>>;
34
+ };
35
+ type FiniteString<K extends string> = string extends K ? never : K;
36
+ type CaseOutput<Cases> = Cases extends Readonly<Record<PropertyKey, GrammarInternal>> ? Type<Cases[keyof Cases]> : never;
37
+ export declare const match: <K extends string, const Cases extends Readonly<Record<K, GrammarInternal>>>(scrutinee: Ref<FiniteString<K>>, cases: Cases) => Grammar<CaseOutput<Cases>>;
38
+ type EntryOutput<Entries extends ReadonlyArray<readonly [MatchKey, GrammarInternal]>> = Type<Entries[number][1]>;
39
+ type CompleteEntries<K extends MatchKey, Entries extends ReadonlyArray<readonly [MatchKey, GrammarInternal]>> = Exclude<K, Entries[number][0]> extends never ? Entries : never;
40
+ export declare const matchValue: <K extends MatchKey, const Entries extends ReadonlyArray<readonly [K, GrammarInternal]>>(scrutinee: Ref<K>, entries: CompleteEntries<K, Entries>) => Grammar<EntryOutput<Entries>>;
41
+ export declare const take: (count: Ref<number>) => Grammar<string>;
42
+ export declare const repeat: {
43
+ <A>(inner: Grammar<A>, count: Ref<number>): Grammar<ReadonlyArray<A>>;
44
+ (count: Ref<number>): <A>(inner: Grammar<A>) => Grammar<ReadonlyArray<A>>;
31
45
  };
32
46
  export interface TransformOptions<A, B> {
33
47
  readonly decode: (a: A) => B;
@@ -36,18 +50,28 @@ export interface TransformOptions<A, B> {
36
50
  readonly name?: string;
37
51
  }
38
52
  export declare const transform: {
39
- <A, B>(f: TransformOptions<A, B>): (inner: Grammar<A>) => Grammar<B>;
40
- <A, B>(inner: Grammar<A>, f: TransformOptions<A, B>): Grammar<B>;
53
+ <A, B>(options: TransformOptions<A, B>): (inner: Grammar<A>) => Grammar<B>;
54
+ <A, B>(inner: Grammar<A>, options: TransformOptions<A, B>): Grammar<B>;
55
+ };
56
+ export interface TransformOrFailOptions<A, B> {
57
+ readonly decode: (a: A) => Result.Result<B, GrammarIssue>;
58
+ readonly encode: (b: B) => Result.Result<A, GrammarIssue>;
59
+ readonly is?: (value: B) => boolean;
60
+ readonly name?: string;
61
+ }
62
+ export declare const transformOrFail: {
63
+ <A, B>(options: TransformOrFailOptions<A, B>): (inner: Grammar<A>) => Grammar<B>;
64
+ <A, B>(inner: Grammar<A>, options: TransformOrFailOptions<A, B>): Grammar<B>;
41
65
  };
42
66
  export interface DecodeToOptions<A, T> extends Omit<TransformOptions<A, T>, "is"> {
43
67
  readonly is?: ((value: T) => boolean) | undefined;
44
68
  }
45
- export declare const decodeTo: <T>(schema: Schema.Codec<T, unknown, unknown, unknown>) => <A>(f: DecodeToOptions<A, T>) => (inner: Grammar<A>) => Grammar<T>;
69
+ export declare const decodeTo: <T>(schema: Schema.Codec<T, unknown, unknown, unknown>) => <A>(options: DecodeToOptions<A, T>) => (inner: Grammar<A>) => Grammar<T>;
46
70
  export declare const as: {
47
71
  <const V>(value: V): (inner: Silent) => Grammar<V>;
48
72
  <const V>(inner: Silent, value: V): Grammar<V>;
49
73
  };
50
- export declare const flag: (s: Silent | string) => Grammar<boolean>;
74
+ export declare const flag: (value: Silent | string) => Grammar<boolean>;
51
75
  export declare const skip: {
52
76
  <A>(printAs: A): (inner: Grammar<A>) => Silent;
53
77
  <A>(inner: Grammar<A>, printAs: A): Silent;
@@ -57,9 +81,30 @@ export declare const label: {
57
81
  <A>(inner: Grammar<A>, name: string): Grammar<A>;
58
82
  };
59
83
  export declare const suspend: <A>(thunk: () => Grammar<A>, name?: string) => Grammar<A>;
60
- export declare const whitespace: Silent;
84
+ export declare const defaulted: {
85
+ <A>(value: A): (inner: Grammar<A | undefined>) => Grammar<A>;
86
+ <A>(inner: Grammar<A | undefined>, value: A): Grammar<A>;
87
+ };
88
+ type StructFields = Readonly<Record<string, GrammarInternal>>;
89
+ type StructValue<Fields extends StructFields> = {
90
+ readonly [K in keyof Fields]: Type<Fields[K]>;
91
+ };
92
+ export declare const struct: <const Fields extends StructFields>(fields: Fields) => Grammar<StructValue<Fields>>;
93
+ type TupleValue<Elements extends ReadonlyArray<GrammarInternal>> = {
94
+ readonly [K in keyof Elements]: Type<Elements[K]>;
95
+ };
96
+ export declare const tuple: <const Elements extends ReadonlyArray<GrammarInternal>>(...elements: Elements) => Grammar<TupleValue<Elements>>;
97
+ type TaggedValue<Tag extends string, Cases extends Readonly<Record<string, GrammarInternal>>> = {
98
+ readonly [K in keyof Cases & string]: Readonly<Record<Tag, K>> & {
99
+ readonly value: Type<Cases[K]>;
100
+ };
101
+ }[keyof Cases & string];
102
+ export declare const taggedChoice: <const Tag extends string, const Cases extends Readonly<Record<string, GrammarInternal>>>(tag: Tag, cases: Cases) => Grammar<TaggedValue<Tag, Cases>>;
103
+ export declare const trivia: Silent;
104
+ export declare const space: Silent;
105
+ export declare const spaces: Silent;
61
106
  export declare function lexeme(inner: Silent): Silent;
62
107
  export declare function lexeme<A>(inner: Grammar<A>): Grammar<A>;
63
- export declare const symbol: (s: string) => Silent;
108
+ export declare const symbol: (value: string) => Silent;
64
109
  export declare const integer: Grammar<number>;
65
110
  //# sourceMappingURL=combinators.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"combinators.d.ts","sourceRoot":"","sources":["../src/combinators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,MAAM,EAAE,MAAM,QAAQ,CAAA;AAErD,OAAO,EAEL,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,OAAO,EAOZ,KAAK,MAAM,EAEX,KAAK,IAAI,EACV,MAAM,WAAW,CAAA;AAGlB,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAEjC,eAAO,MAAM,OAAO,UAAW,MAAM,WAAuC,CAAA;AAE5E,eAAO,MAAM,KAAK,QAAc,CAAA;AAEhC,sFAAsF;AACtF,eAAO,MAAM,KAAK,OAAQ,MAAM,QAAQ,MAAM,KAAG,OAAO,CAAC,MAAM,CAQ9D,CAAA;AAMD,wBAAgB,GAAG,CAAC,GAAG,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,CAAA;AAC5D,wBAAgB,GAAG,CAAC,KAAK,CAAC,KAAK,SAAS,aAAa,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAChF,GAAG,KAAK,EAAE,KAAK,GACd,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;AAKjC,e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