effect-grammar 0.0.1 → 0.1.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.
- package/LICENSE +21 -0
- package/README.md +124 -62
- package/dist/combinators.d.ts +64 -27
- package/dist/combinators.d.ts.map +1 -1
- package/dist/combinators.js +73 -91
- package/dist/combinators.js.map +1 -1
- package/dist/core.d.ts +85 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +34 -0
- package/dist/core.js.map +1 -0
- package/dist/errors.d.ts +19 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +27 -0
- package/dist/errors.js.map +1 -0
- package/dist/grammar.d.ts +7 -190
- package/dist/grammar.d.ts.map +1 -1
- package/dist/grammar.js +7 -494
- package/dist/grammar.js.map +1 -1
- package/dist/index.d.ts +7 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/parse.d.ts +5 -0
- package/dist/parse.d.ts.map +1 -0
- package/dist/parse.js +157 -0
- package/dist/parse.js.map +1 -0
- package/dist/print.d.ts +5 -0
- package/dist/print.d.ts.map +1 -0
- package/dist/print.js +121 -0
- package/dist/print.js.map +1 -0
- package/dist/render.d.ts +5 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +64 -0
- package/dist/render.js.map +1 -0
- package/dist/schema.d.ts +6 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +9 -0
- package/dist/schema.js.map +1 -0
- package/package.json +22 -21
- package/dist/error.d.ts +0 -28
- package/dist/error.d.ts.map +0 -1
- package/dist/error.js +0 -52
- package/dist/error.js.map +0 -1
- package/dist/parser.d.ts +0 -6
- package/dist/parser.d.ts.map +0 -1
- package/dist/parser.js +0 -6
- package/dist/parser.js.map +0 -1
- package/dist/run.d.ts +0 -6
- package/dist/run.d.ts.map +0 -1
- package/dist/run.js +0 -11
- package/dist/run.js.map +0 -1
- package/dist/state.d.ts +0 -51
- package/dist/state.d.ts.map +0 -1
- package/dist/state.js +0 -114
- package/dist/state.js.map +0 -1
- package/dist/stream.d.ts +0 -18
- package/dist/stream.d.ts.map +0 -1
- package/dist/stream.js +0 -38
- package/dist/stream.js.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sai Ashirwad
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,42 +1,92 @@
|
|
|
1
1
|
# effect-grammar
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Invertible grammar combinators and parser-printers for Effect.
|
|
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.
|
|
6
|
+
|
|
7
|
+
You write the grammar definition once. You get four outputs:
|
|
8
|
+
|
|
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.
|
|
13
|
+
|
|
14
|
+
## Why effect-grammar?
|
|
15
|
+
|
|
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.
|
|
19
|
+
|
|
20
|
+
This is for format strings, not documents. The parser backtracks with no memoization and no left recursion. Printing is canonical, not pretty.
|
|
5
21
|
|
|
6
22
|
## Install
|
|
7
23
|
|
|
8
24
|
```bash
|
|
9
|
-
pnpm add effect-grammar
|
|
25
|
+
pnpm add effect-grammar
|
|
10
26
|
```
|
|
11
27
|
|
|
12
|
-
Depends on Effect v4.
|
|
13
|
-
|
|
14
|
-
## Grammar
|
|
28
|
+
Depends on Effect v4. The package pins `effect` to `4.0.0-beta.102` for now.
|
|
15
29
|
|
|
16
|
-
|
|
17
|
-
Schema.
|
|
30
|
+
## A grammar
|
|
18
31
|
|
|
19
32
|
```ts
|
|
20
33
|
import { Schema } from "effect"
|
|
21
|
-
import
|
|
22
|
-
|
|
23
|
-
const endpoint = Grammar.
|
|
24
|
-
Grammar.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
import * as Grammar from "effect-grammar"
|
|
35
|
+
|
|
36
|
+
const endpoint = Grammar.gen(function* () {
|
|
37
|
+
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
|
+
})
|
|
45
|
+
|
|
46
|
+
Grammar.parse(endpoint, "https://effect.website:8080")
|
|
47
|
+
// Result.succeed({ host: "effect.website", port: 8080 })
|
|
48
|
+
Grammar.parse(endpoint, "https://effect.website:abc")
|
|
49
|
+
// Result.fail(ParseError: line 1, column 24: expected integer, found "a")
|
|
50
|
+
Grammar.print(endpoint, { host: "effect.website", port: 443 })
|
|
51
|
+
// Result.succeed("https://effect.website:443")
|
|
52
|
+
Grammar.render(endpoint)
|
|
53
|
+
// "https://" host:<host> port:(":" <integer>)?
|
|
54
|
+
```
|
|
55
|
+
|
|
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)`.
|
|
59
|
+
|
|
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.
|
|
64
|
+
|
|
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.
|
|
71
|
+
|
|
72
|
+
`seq` is the same field object without generator control flow. It renders every
|
|
73
|
+
part:
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
const member = Grammar.seq(
|
|
77
|
+
Grammar.field("key", jsonString),
|
|
78
|
+
Grammar.symbol(":"),
|
|
79
|
+
Grammar.field("value", jsonValue),
|
|
39
80
|
)
|
|
81
|
+
// Grammar<{ key: string; value: Json }>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## The Schema
|
|
85
|
+
|
|
86
|
+
`toSchema` takes the grammar and the Schema it should decode to. Parsing happens
|
|
87
|
+
first, then the target's refinements. Encoding prints.
|
|
88
|
+
|
|
89
|
+
```ts
|
|
40
90
|
const Endpoint = Grammar.toSchema(
|
|
41
91
|
endpoint,
|
|
42
92
|
Schema.Struct({
|
|
@@ -45,52 +95,64 @@ const Endpoint = Grammar.toSchema(
|
|
|
45
95
|
}),
|
|
46
96
|
{ identifier: "Endpoint" },
|
|
47
97
|
)
|
|
48
|
-
|
|
49
|
-
Schema.
|
|
98
|
+
|
|
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"
|
|
50
103
|
```
|
|
51
104
|
|
|
52
|
-
##
|
|
105
|
+
## Values and alternatives
|
|
53
106
|
|
|
54
|
-
|
|
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.
|
|
55
110
|
|
|
56
111
|
```ts
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const digits = yield* many(digit, { atLeast: 1 })
|
|
66
|
-
const n = Number(digits.join(""))
|
|
67
|
-
if (n > 255) return yield* new OutOfRange({ n })
|
|
68
|
-
return n
|
|
69
|
-
})
|
|
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,
|
|
117
|
+
}),
|
|
118
|
+
)
|
|
119
|
+
```
|
|
70
120
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
yield* char(".")
|
|
74
|
-
const b = yield* byte
|
|
75
|
-
yield* char(".")
|
|
76
|
-
const c = yield* byte
|
|
77
|
-
yield* char(".")
|
|
78
|
-
const d = yield* byte
|
|
79
|
-
yield* endOfInput
|
|
80
|
-
return [a, b, c, d] as const
|
|
81
|
-
})
|
|
121
|
+
`as` turns a silent grammar into a constant. `flag` turns presence into a
|
|
122
|
+
boolean:
|
|
82
123
|
|
|
83
|
-
|
|
84
|
-
|
|
124
|
+
```ts
|
|
125
|
+
const jsonNull = Grammar.symbol("null").pipe(Grammar.as(null))
|
|
126
|
+
const negate = Grammar.flag("-")
|
|
85
127
|
```
|
|
86
128
|
|
|
87
|
-
|
|
129
|
+
Recursion uses `suspend`:
|
|
88
130
|
|
|
89
|
-
|
|
131
|
+
```ts
|
|
132
|
+
const jsonValue: Grammar.Grammar<Json> = Grammar.suspend(
|
|
133
|
+
() =>
|
|
134
|
+
Grammar.choice(
|
|
135
|
+
jsonNull,
|
|
136
|
+
jsonBool,
|
|
137
|
+
jsonNumber,
|
|
138
|
+
jsonString,
|
|
139
|
+
jsonArray,
|
|
140
|
+
jsonObject,
|
|
141
|
+
),
|
|
142
|
+
"value",
|
|
143
|
+
)
|
|
144
|
+
```
|
|
90
145
|
|
|
91
|
-
|
|
92
|
-
|
|
146
|
+
See `examples/` for JSON, Scheme, a Postgres DSN, netstrings, and GitHub's
|
|
147
|
+
search syntax.
|
|
148
|
+
|
|
149
|
+
## Errors
|
|
150
|
+
|
|
151
|
+
`choice` backtracks. Errors report the furthest position the parser reached and
|
|
152
|
+
everything that could have matched there:
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
line 1, column 7: expected one of "null", "true", "false", number, string, "[", "{", found end of input
|
|
93
156
|
```
|
|
94
157
|
|
|
95
|
-
|
|
96
|
-
request. Merging that pull request publishes the package to npm.
|
|
158
|
+
`label(name)` names a grammar for these messages.
|
package/dist/combinators.d.ts
CHANGED
|
@@ -1,28 +1,65 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
|
|
7
|
-
export declare const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export declare
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export declare
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
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";
|
|
4
|
+
export declare const literal: (value: string) => Silent;
|
|
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>;
|
|
13
|
+
export declare function prefix(open: Silent | string, inner: Silent): Silent;
|
|
14
|
+
export declare function prefix<A>(open: Silent | string, inner: Grammar<A>): Grammar<A>;
|
|
15
|
+
export declare function suffix(inner: Silent, close: Silent | string): Silent;
|
|
16
|
+
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]>>;
|
|
18
|
+
export declare function optional(inner: Silent): Silent;
|
|
19
|
+
export declare function optional<A>(inner: Grammar<A>): Grammar<A | undefined>;
|
|
20
|
+
export interface RepeatOptions {
|
|
21
|
+
readonly min?: number;
|
|
22
|
+
readonly max?: number;
|
|
23
|
+
}
|
|
24
|
+
export declare const many: {
|
|
25
|
+
<A>(inner: Grammar<A>, opts?: RepeatOptions): Grammar<ReadonlyArray<A>>;
|
|
26
|
+
(opts?: RepeatOptions): <A>(inner: Grammar<A>) => Grammar<ReadonlyArray<A>>;
|
|
27
|
+
};
|
|
28
|
+
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>>;
|
|
31
|
+
};
|
|
32
|
+
export interface TransformOptions<A, B> {
|
|
33
|
+
readonly decode: (a: A) => B;
|
|
34
|
+
readonly encode: (b: B) => A;
|
|
35
|
+
readonly is?: (value: B) => boolean;
|
|
36
|
+
readonly name?: string;
|
|
37
|
+
}
|
|
38
|
+
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>;
|
|
41
|
+
};
|
|
42
|
+
export interface DecodeToOptions<A, T> extends Omit<TransformOptions<A, T>, "is"> {
|
|
43
|
+
readonly is?: ((value: T) => boolean) | undefined;
|
|
44
|
+
}
|
|
45
|
+
export declare const decodeTo: <T>(schema: Schema.Codec<T, unknown, unknown, unknown>) => <A>(f: DecodeToOptions<A, T>) => (inner: Grammar<A>) => Grammar<T>;
|
|
46
|
+
export declare const as: {
|
|
47
|
+
<const V>(value: V): (inner: Silent) => Grammar<V>;
|
|
48
|
+
<const V>(inner: Silent, value: V): Grammar<V>;
|
|
49
|
+
};
|
|
50
|
+
export declare const flag: (s: Silent | string) => Grammar<boolean>;
|
|
51
|
+
export declare const skip: {
|
|
52
|
+
<A>(printAs: A): (inner: Grammar<A>) => Silent;
|
|
53
|
+
<A>(inner: Grammar<A>, printAs: A): Silent;
|
|
54
|
+
};
|
|
55
|
+
export declare const label: {
|
|
56
|
+
(name: string): <A>(inner: Grammar<A>) => Grammar<A>;
|
|
57
|
+
<A>(inner: Grammar<A>, name: string): Grammar<A>;
|
|
58
|
+
};
|
|
59
|
+
export declare const suspend: <A>(thunk: () => Grammar<A>, name?: string) => Grammar<A>;
|
|
60
|
+
export declare const whitespace: Silent;
|
|
61
|
+
export declare function lexeme(inner: Silent): Silent;
|
|
62
|
+
export declare function lexeme<A>(inner: Grammar<A>): Grammar<A>;
|
|
63
|
+
export declare const symbol: (s: string) => Silent;
|
|
64
|
+
export declare const integer: Grammar<number>;
|
|
28
65
|
//# sourceMappingURL=combinators.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combinators.d.ts","sourceRoot":"","sources":["../src/combinators.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
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,K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CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAA;IACpD,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;CACyC,CAAA;AAE3F,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,MAAM,OAAO,CAAC,CAAC,CAAC,SAAS,MAAM,KAAG,OAAO,CAAC,CAAC,CACrC,CAAA;AAKxC,eAAO,MAAM,UAAU,QAAuB,CAAA;AAE9C,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;AAC7C,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;AAKxD,eAAO,MAAM,MAAM,MAAO,MAAM,WAAuB,CAAA;AAEvD,eAAO,MAAM,OAAO,EAAE,OAAO,CAAC,MAAM,CAEnC,CAAA"}
|
package/dist/combinators.js
CHANGED
|
@@ -1,95 +1,77 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const normalized = new RegExp(re.source, re.flags.replace(/[gy]/g, ""));
|
|
16
|
-
return Effect.gen(function* () {
|
|
17
|
-
const pos = yield* getPos;
|
|
18
|
-
const m = yield* matchRegex(normalized);
|
|
19
|
-
if (Option.isNone(m))
|
|
20
|
-
return yield* failHere(expected);
|
|
21
|
-
yield* seek(pos + m.value.length);
|
|
22
|
-
return m.value;
|
|
1
|
+
import { Equal, Function as F, Schema } from "effect";
|
|
2
|
+
import { isField, isGrammar, isSilent, make, silent, } from "./core.js";
|
|
3
|
+
import { preview } from "./errors.js";
|
|
4
|
+
export { field } from "./core.js";
|
|
5
|
+
export const literal = (value) => silent({ _tag: "Literal", value });
|
|
6
|
+
export const empty = literal("");
|
|
7
|
+
/** The regex is made sticky so the parser can match at a position without slicing. */
|
|
8
|
+
export const regex = (re, name) => {
|
|
9
|
+
const flags = re.flags.replace(/[gy]/g, "");
|
|
10
|
+
return make({
|
|
11
|
+
_tag: "Regex",
|
|
12
|
+
re: new RegExp(re.source, `${flags}y`),
|
|
13
|
+
whole: new RegExp(`^(?:${re.source})$`, flags),
|
|
14
|
+
name,
|
|
23
15
|
});
|
|
24
16
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
* original position for messages.
|
|
58
|
-
*/
|
|
59
|
-
export const attempt = (p) => Effect.gen(function* () {
|
|
60
|
-
const mark = yield* getPos;
|
|
61
|
-
const r = yield* Effect.result(p);
|
|
62
|
-
if (r._tag === "Success")
|
|
63
|
-
return r.success;
|
|
64
|
-
if (Schema.is(ParseError)(r.failure))
|
|
65
|
-
yield* seek(mark);
|
|
66
|
-
return yield* Effect.fail(r.failure);
|
|
67
|
-
});
|
|
68
|
-
/**
|
|
69
|
-
* Run `p` zero or more times (`atLeast` sets a minimum). If `p` fails after
|
|
70
|
-
* consuming input, `many` fails too — wrap `p` in {@link attempt} to keep
|
|
71
|
-
* collecting instead.
|
|
72
|
-
*/
|
|
73
|
-
export const many = (p, opts) => Effect.gen(function* () {
|
|
74
|
-
const out = [];
|
|
75
|
-
const atLeast = opts?.atLeast ?? 0;
|
|
76
|
-
for (let i = 0; i < atLeast; i++)
|
|
77
|
-
out.push(yield* p);
|
|
78
|
-
while (true) {
|
|
79
|
-
const mark = yield* getPos;
|
|
80
|
-
const r = yield* Effect.result(p);
|
|
81
|
-
if (r._tag === "Failure") {
|
|
82
|
-
if (!Schema.is(ParseError)(r.failure))
|
|
83
|
-
return yield* Effect.fail(r.failure);
|
|
84
|
-
if ((yield* getPos) > mark)
|
|
85
|
-
return yield* r.failure;
|
|
86
|
-
yield* seek(mark);
|
|
87
|
-
return out;
|
|
88
|
-
}
|
|
89
|
-
if ((yield* getPos) === mark) {
|
|
90
|
-
return yield* Effect.die(new Error("many: parser succeeded without consuming input"));
|
|
91
|
-
}
|
|
92
|
-
out.push(r.success);
|
|
17
|
+
const _toSilent = (s) => (isGrammar(s) ? s : literal(s));
|
|
18
|
+
const _silentIf = (cond, node) => (cond ? silent(node) : make(node));
|
|
19
|
+
export function seq(...parts) {
|
|
20
|
+
return _silentIf(!parts.some(isField), { _tag: "Seq", parts });
|
|
21
|
+
}
|
|
22
|
+
export const gen = (run) => make({ _tag: "Gen", run });
|
|
23
|
+
export function wrap(open, inner, close) {
|
|
24
|
+
return _silentIf(isSilent(inner), {
|
|
25
|
+
_tag: "Wrap",
|
|
26
|
+
open: _toSilent(open),
|
|
27
|
+
inner,
|
|
28
|
+
close: _toSilent(close),
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export function prefix(open, inner) {
|
|
32
|
+
return wrap(open, inner, empty);
|
|
33
|
+
}
|
|
34
|
+
export function suffix(inner, close) {
|
|
35
|
+
return wrap(empty, inner, close);
|
|
36
|
+
}
|
|
37
|
+
export const choice = (...options) => make({ _tag: "Choice", options });
|
|
38
|
+
export function optional(inner) {
|
|
39
|
+
return _silentIf(isSilent(inner), { _tag: "Optional", inner });
|
|
40
|
+
}
|
|
41
|
+
const bounds = (name, opts) => {
|
|
42
|
+
const min = opts?.min ?? 0;
|
|
43
|
+
const max = opts?.max ?? Number.POSITIVE_INFINITY;
|
|
44
|
+
if (!Number.isSafeInteger(min) || min < 0) {
|
|
45
|
+
throw new RangeError(`${name}: min must be a non-negative safe integer`);
|
|
46
|
+
}
|
|
47
|
+
if (max !== Number.POSITIVE_INFINITY && !(Number.isSafeInteger(max) && max >= min)) {
|
|
48
|
+
throw new RangeError(`${name}: max must be a safe integer >= min`);
|
|
93
49
|
}
|
|
94
|
-
}
|
|
50
|
+
return { min, max };
|
|
51
|
+
};
|
|
52
|
+
const _dataFirst = (args) => isGrammar(args[0]);
|
|
53
|
+
export const many = F.dual(_dataFirst, (inner, opts) => make({ _tag: "Many", inner, sep: empty, ...bounds("many", opts) }));
|
|
54
|
+
export const sepBy = F.dual(_dataFirst, (inner, sep, opts) => make({ _tag: "Many", inner, sep: _toSilent(sep), ...bounds("sepBy", opts) }));
|
|
55
|
+
export const transform = F.dual(2, (inner, f) => make({ _tag: "Transform", inner, ...f }));
|
|
56
|
+
export const decodeTo = (schema) => (f) => (inner) => {
|
|
57
|
+
let is;
|
|
58
|
+
return transform(inner, { ...f, is: f.is ?? ((value) => (is ??= Schema.is(schema))(value)) });
|
|
59
|
+
};
|
|
60
|
+
export const as = F.dual(2, (inner, value) => transform(inner, {
|
|
61
|
+
decode: () => value,
|
|
62
|
+
encode: () => undefined,
|
|
63
|
+
is: (u) => Equal.equals(u, value),
|
|
64
|
+
name: preview(value),
|
|
65
|
+
}));
|
|
66
|
+
export const flag = (s) => choice(as(_toSilent(s), true), as(empty, false));
|
|
67
|
+
export const skip = F.dual(2, (inner, printAs) => silent({ _tag: "Skip", inner, printAs, show: true }));
|
|
68
|
+
export const label = F.dual(2, (inner, name) => make({ _tag: "Label", inner, name }));
|
|
69
|
+
export const suspend = (thunk, name) => make({ _tag: "Suspend", thunk, name });
|
|
70
|
+
const hiddenWhitespace = (printAs) => silent({ _tag: "Skip", inner: regex(/\s*/, "whitespace"), printAs, show: false });
|
|
71
|
+
export const whitespace = hiddenWhitespace("");
|
|
72
|
+
export function lexeme(inner) {
|
|
73
|
+
return suffix(inner, hiddenWhitespace(" "));
|
|
74
|
+
}
|
|
75
|
+
export const symbol = (s) => lexeme(literal(s));
|
|
76
|
+
export const integer = regex(/-?\d+/, "integer").pipe(transform({ decode: Number, encode: String, is: Number.isSafeInteger, name: "integer" }));
|
|
95
77
|
//# sourceMappingURL=combinators.js.map
|
package/dist/combinators.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combinators.js","sourceRoot":"","sources":["../src/combinators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"combinators.js","sourceRoot":"","sources":["../src/combinators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAErD,OAAO,EAKL,OAAO,EACP,SAAS,EACT,QAAQ,EACR,IAAI,EAIJ,MAAM,GAEP,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAErC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAEjC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAA;AAE5E,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC,EAAE,CAAC,CAAA;AAEhC,sFAAsF;AACtF,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,IAAY,EAAmB,EAAE;IACjE,MAAM,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;IAC3C,OAAO,IAAI,CAAC;QACV,IAAI,EAAE,OAAO;QACb,EA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