@tabnas/abnf 0.4.1 → 0.4.2

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/dist/abnf.d.ts CHANGED
@@ -4,4 +4,4 @@ import { abnfCompile, toRecognitionSpec, toPureSpec, toJsonic, attachActions, at
4
4
  declare const abnf: Plugin;
5
5
  export { VERSION, abnf, abnfConvert, parseAbnf, emitGrammarSpec, eliminateLeftRecursion, abnfRules, AbnfParseError, abnfCompile, toRecognitionSpec, toPureSpec, toJsonic, attachActions, attachActionSlots, markListing, AbnfCompileError, AbnfActionError, };
6
6
  export type { AbnfConvertOptions, AbnfCompileOptions, ActionsMap };
7
- declare const VERSION = "0.4.1";
7
+ declare const VERSION = "0.4.2";
package/dist/abnf.js CHANGED
@@ -36,6 +36,6 @@ exports.abnf = abnf;
36
36
  // VERSION is this package's version. It MUST equal package.json "version":
37
37
  // the release orchestrator rewrites both, and the version test fails the
38
38
  // build if they drift. Mirrors `const VERSION` in go/abnf.go.
39
- const VERSION = '0.4.1';
39
+ const VERSION = '0.4.2';
40
40
  exports.VERSION = VERSION;
41
41
  //# sourceMappingURL=abnf.js.map
package/dist/compile.d.ts CHANGED
@@ -1,26 +1,7 @@
1
- import type { GrammarSpec } from '@tabnas/parser';
2
- import { AbnfConvertOptions } from './converter';
3
- export declare class AbnfCompileError extends Error {
4
- rules: string[];
5
- constructor(message: string, rules: string[]);
6
- }
7
- export declare function toRecognitionSpec(spec: GrammarSpec): GrammarSpec;
8
- export declare function toPureSpec(spec: GrammarSpec): GrammarSpec;
9
- export type JsonicOptions = {
10
- strict?: boolean;
11
- indent?: number;
12
- };
13
- export declare function toJsonic(value: any, opts?: JsonicOptions): string;
14
- export declare class AbnfActionError extends Error {
15
- constructor(message: string);
16
- }
17
- type ActionFn = (r: any, ctx: any, alt: any) => any;
18
- export type ActionsMap = Record<string, ActionFn | ActionFn[]>;
19
- export declare function attachActions(spec: GrammarSpec, actions: ActionsMap): GrammarSpec;
20
- export declare function attachActionSlots(spec: GrammarSpec, refNames: string[]): GrammarSpec;
21
- export declare function markListing(spec: GrammarSpec): string;
22
- export type AbnfCompileOptions = AbnfConvertOptions & JsonicOptions & {
23
- recognition?: boolean;
24
- };
1
+ import { toRecognitionSpec, toPureSpec, toJsonic, attachActions, attachActionSlots, markListing, CompileError, ActionError } from '@tabnas/bnf';
2
+ import type { CompileOptions, JsonicOptions, ActionsMap } from '@tabnas/bnf';
3
+ export { CompileError as AbnfCompileError, ActionError as AbnfActionError };
4
+ type AbnfCompileOptions = CompileOptions;
25
5
  export declare function abnfCompile(src: string, opts?: AbnfCompileOptions): string;
26
- export {};
6
+ export { toRecognitionSpec, toPureSpec, toJsonic, attachActions, attachActionSlots, markListing, };
7
+ export type { AbnfCompileOptions, JsonicOptions, ActionsMap };
package/dist/compile.js CHANGED
@@ -1,341 +1,23 @@
1
1
  "use strict";
2
2
  /* Copyright (c) 2026 Richard Rodger and other contributors, MIT License */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.AbnfActionError = exports.AbnfCompileError = void 0;
5
- exports.toRecognitionSpec = toRecognitionSpec;
6
- exports.toPureSpec = toPureSpec;
7
- exports.toJsonic = toJsonic;
8
- exports.attachActions = attachActions;
9
- exports.attachActionSlots = attachActionSlots;
10
- exports.markListing = markListing;
4
+ exports.markListing = exports.attachActionSlots = exports.attachActions = exports.toJsonic = exports.toPureSpec = exports.toRecognitionSpec = exports.AbnfActionError = exports.AbnfCompileError = void 0;
11
5
  exports.abnfCompile = abnfCompile;
12
- const parser_1 = require("@tabnas/parser");
6
+ const bnf_1 = require("@tabnas/bnf");
7
+ Object.defineProperty(exports, "toRecognitionSpec", { enumerable: true, get: function () { return bnf_1.toRecognitionSpec; } });
8
+ Object.defineProperty(exports, "toPureSpec", { enumerable: true, get: function () { return bnf_1.toPureSpec; } });
9
+ Object.defineProperty(exports, "toJsonic", { enumerable: true, get: function () { return bnf_1.toJsonic; } });
10
+ Object.defineProperty(exports, "attachActions", { enumerable: true, get: function () { return bnf_1.attachActions; } });
11
+ Object.defineProperty(exports, "attachActionSlots", { enumerable: true, get: function () { return bnf_1.attachActionSlots; } });
12
+ Object.defineProperty(exports, "markListing", { enumerable: true, get: function () { return bnf_1.markListing; } });
13
+ Object.defineProperty(exports, "AbnfCompileError", { enumerable: true, get: function () { return bnf_1.CompileError; } });
14
+ Object.defineProperty(exports, "AbnfActionError", { enumerable: true, get: function () { return bnf_1.ActionError; } });
13
15
  const converter_1 = require("./converter");
14
- // Hook fields whose string value is a `@`-ref into `spec.ref`. These
15
- // are the AST-building actions compilation mode drops.
16
- const REF_FIELDS = new Set(['a', 'bo', 'bc']);
17
- // Tree-building `$`-builtins (emitted with `builtins: true`). Pure
18
- // recognition mode drops these too; their per-alt config lives under
19
- // `k.node$` / `k.capture$`.
20
- const TREE_BUILTINS = new Set(['@node$', '@capture$', '@bubble$', '@fold$']);
21
- const TREE_CONFIG_KEYS = ['node$', 'capture$', 'fold$'];
22
- class AbnfCompileError extends Error {
23
- constructor(message, rules) {
24
- super(message);
25
- this.name = 'AbnfCompileError';
26
- this.rules = rules;
27
- }
28
- }
29
- exports.AbnfCompileError = AbnfCompileError;
30
- // Deep clone that preserves RegExp instances (match-token matchers)
31
- // and drops every function-valued property.
32
- function cloneData(v) {
33
- if (v instanceof RegExp)
34
- return v;
35
- if (Array.isArray(v))
36
- return v.map(cloneData);
37
- if (v && 'object' === typeof v) {
38
- const o = {};
39
- for (const k of Object.keys(v)) {
40
- if ('function' === typeof v[k])
41
- continue;
42
- o[k] = cloneData(v[k]);
43
- }
44
- return o;
45
- }
46
- return v;
47
- }
48
- // Like `cloneData`, but also drops the AST-building hooks: `a`/`bo`/`bc`
49
- // fields that point at a dropped action (a `spec.ref` closure or a tree
50
- // `$`-builtin), and the now-orphaned `k.node$` / `k.capture$` config.
51
- // Control builtins (`@probe…$`) and structural fields are preserved.
52
- function cloneRecognition(v, isDropped) {
53
- if (v instanceof RegExp)
54
- return v;
55
- if (Array.isArray(v))
56
- return v.map((x) => cloneRecognition(x, isDropped));
57
- if (v && 'object' === typeof v) {
58
- const o = {};
59
- for (const k of Object.keys(v)) {
60
- const x = v[k];
61
- if ('function' === typeof x)
62
- continue;
63
- if (REF_FIELDS.has(k) && 'string' === typeof x && isDropped(x))
64
- continue;
65
- if ('k' === k && x && 'object' === typeof x) {
66
- const kc = cloneRecognition(x, isDropped);
67
- for (const tk of TREE_CONFIG_KEYS)
68
- delete kc[tk];
69
- if (0 === Object.keys(kc).length)
70
- continue;
71
- o[k] = kc;
72
- continue;
73
- }
74
- o[k] = cloneRecognition(x, isDropped);
75
- }
76
- return o;
77
- }
78
- return v;
79
- }
80
- // Find rules that reference the ref map from a field *other than* the
81
- // droppable AST hooks — i.e. control functions (probe `c:` guards and
82
- // dispatch actions). Their presence means the grammar can't be
83
- // represented purely structurally yet.
84
- function controlRefRules(spec, isRef) {
85
- const offenders = new Set();
86
- const scan = (o, rule) => {
87
- if (Array.isArray(o)) {
88
- o.forEach((x) => scan(x, rule));
89
- return;
90
- }
91
- if (!o || 'object' !== typeof o)
92
- return;
93
- for (const k of Object.keys(o)) {
94
- const x = o[k];
95
- if (!REF_FIELDS.has(k) && 'string' === typeof x && isRef(x)) {
96
- offenders.add(rule);
97
- }
98
- else {
99
- scan(x, rule);
100
- }
101
- }
102
- };
103
- const rules = spec.rule ?? {};
104
- for (const name of Object.keys(rules))
105
- scan(rules[name], name);
106
- return [...offenders].sort();
107
- }
108
- // Strip a converted spec down to a function-free recognition grammar.
109
- // Throws `AbnfCompileError` for grammars whose control logic is still
110
- // closures (i.e. a probe dispatcher converted without `builtins`).
111
- function toRecognitionSpec(spec) {
112
- const ref = spec.ref ?? {};
113
- const isRef = (s) => Object.prototype.hasOwnProperty.call(ref, s);
114
- const offenders = controlRefRules(spec, isRef);
115
- if (offenders.length > 0) {
116
- throw new AbnfCompileError('abnf: grammar needs control functions (probe / unbounded ' +
117
- 'lookahead) and cannot be emitted as a pure recognition grammar; ' +
118
- 'recompile with `builtins: true`. Offending rule(s): ' +
119
- offenders.join(', '), offenders);
120
- }
121
- const isDropped = (s) => isRef(s) || TREE_BUILTINS.has(s);
122
- const out = cloneRecognition({ options: spec.options, rule: spec.rule }, isDropped);
123
- // Declare the builtin config-schema version so the engine can refuse a
124
- // grammar that needs a newer schema than it implements.
125
- out.v = parser_1.BUILTIN_SCHEMA_VERSION;
126
- return out;
127
- }
128
- // Reduce a spec to a pure-data, function-free grammar that *keeps* the
129
- // AST-building `$`-builtins (so the deserialized grammar builds the
130
- // full `{rule,src,kids}` tree). Requires `builtins: true` conversion —
131
- // throws if any closures remain in `spec.ref`.
132
- function toPureSpec(spec) {
133
- const ref = spec.ref ?? {};
134
- const closures = Object.keys(ref);
135
- if (closures.length > 0) {
136
- throw new AbnfCompileError('abnf: spec still contains closures; convert with `builtins: true` ' +
137
- 'for pure-data output. Stray ref(s): ' + closures.slice(0, 3).join(', '), []);
138
- }
139
- const out = cloneData({ options: spec.options, rule: spec.rule });
140
- out.v = parser_1.BUILTIN_SCHEMA_VERSION;
141
- return out;
142
- }
143
- const IDENT = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
144
- // Serialise a (function-free) value as jsonic text. Relaxed by
145
- // default: bare identifier keys, single-quoted strings, newline-
146
- // separated entries. `strict: true` emits valid JSON (double quotes,
147
- // comma-separated) for round-trip verification. RegExp instances are
148
- // emitted as `@/source/flags` strings (jsonic's `resolveFuncRefs`
149
- // reconstructs them on load).
150
- function toJsonic(value, opts = {}) {
151
- const strict = !!opts.strict;
152
- const ind = opts.indent ?? 2;
153
- const sep = strict ? ',\n' : '\n';
154
- const pad = (n) => ' '.repeat(ind * n);
155
- const quote = (s, ch) => ch + s
156
- .replace(/\\/g, '\\\\')
157
- .replace(new RegExp(ch, 'g'), '\\' + ch)
158
- .replace(/\n/g, '\\n') + ch;
159
- const dq = (s) => quote(s, '"');
160
- const str = (s) => strict ? dq(s) : quote(s, "'");
161
- const key = (k) => (!strict && IDENT.test(k)) ? k : dq(k);
162
- const ser = (v, depth) => {
163
- if (null === v || undefined === v)
164
- return 'null';
165
- if (v instanceof RegExp) {
166
- // `@~/…/` carries the `eager$` matcher flag through serialisation;
167
- // plain `@/…/` for ordinary regexes.
168
- const sentinel = v.eager$ ? '@~/' : '@/';
169
- return str(sentinel + v.source + '/' + v.flags);
170
- }
171
- const t = typeof v;
172
- if ('number' === t || 'boolean' === t)
173
- return String(v);
174
- if ('string' === t)
175
- return str(v);
176
- if (Array.isArray(v)) {
177
- if (0 === v.length)
178
- return '[]';
179
- const items = v.map((x) => pad(depth + 1) + ser(x, depth + 1));
180
- return '[\n' + items.join(sep) + '\n' + pad(depth) + ']';
181
- }
182
- if ('object' === t) {
183
- const keys = Object.keys(v);
184
- if (0 === keys.length)
185
- return '{}';
186
- const items = keys.map((k) => pad(depth + 1) + key(k) + ': ' + ser(v[k], depth + 1));
187
- return '{\n' + items.join(sep) + '\n' + pad(depth) + '}';
188
- }
189
- return 'null';
190
- };
191
- return ser(value, 0);
192
- }
193
- // ---- User semantic actions (the `m`-mark feature) -----------------
194
- class AbnfActionError extends Error {
195
- constructor(message) {
196
- super(message);
197
- this.name = 'AbnfActionError';
198
- }
199
- }
200
- exports.AbnfActionError = AbnfActionError;
201
- const PHASES = new Set(['bo', 'ao', 'bc', 'ac']);
202
- // Compose a previous action (the compiler's own, run first) with the
203
- // user's, in attachment order — the synthetic wrapper from the design.
204
- function composeActions(prev, fns) {
205
- const prevFn = 'function' === typeof prev ? prev : null;
206
- return (r, ctx, alt) => {
207
- if (prevFn)
208
- prevFn(r, ctx, alt);
209
- for (const fn of fns)
210
- fn(r, ctx, alt);
211
- };
212
- }
213
- // Collapse a function list into a single action (or pass one through).
214
- function seqActions(fns) {
215
- return 1 === fns.length ? fns[0] : (r, ctx, alt) => {
216
- for (const fn of fns)
217
- fn(r, ctx, alt);
218
- };
219
- }
220
- // Append an action ref/fn to an alt's `a`, producing the engine's
221
- // array-`a` form so the alt's own action runs first, then the new one.
222
- function appendAction(existing, added) {
223
- if (null == existing)
224
- return added;
225
- return Array.isArray(existing) ? [...existing, added] : [existing, added];
226
- }
227
- function altListOf(field) {
228
- return Array.isArray(field) ? field : (field && field.alts) || [];
229
- }
230
- // Resolve `@<rule>:<sel>` against the spec; return the matched alts (for
231
- // o:/c: selectors) or the rule-phase string (for bo/ao/bc/ac).
232
- function resolveTarget(spec, key) {
233
- // `$` is reserved for engine builtins (the `@…$` namespace); a user
234
- // action ref may not contain it. The engine enforces the same on
235
- // spec.ref keys at load — fail early here with a clearer message.
236
- if (key.includes('$')) {
237
- throw new AbnfActionError(`abnf: '$' is reserved for engine builtins; user action ref ` +
238
- `'${key}' may not contain '$'`);
239
- }
240
- const m = /^@([^:]+):(.+)$/.exec(key);
241
- if (!m) {
242
- throw new AbnfActionError(`abnf: malformed action ref '${key}' ` +
243
- `(expected @rule:phase or @rule:o|c:mark)`);
244
- }
245
- const rule = m[1];
246
- const sel = m[2];
247
- const rules = (spec.rule ?? {});
248
- if (!rules[rule]) {
249
- throw new AbnfActionError(`abnf: action ref '${key}' targets unknown rule '${rule}'`);
250
- }
251
- if (PHASES.has(sel))
252
- return { phase: sel };
253
- const pm = /^([oc]):(.+)$/.exec(sel);
254
- if (!pm)
255
- throw new AbnfActionError(`abnf: malformed action ref '${key}'`);
256
- const phase = 'o' === pm[1] ? 'open' : 'close';
257
- const mark = pm[2];
258
- const alts = altListOf(rules[rule][phase]).filter((a) => a && a.m === mark);
259
- if (0 === alts.length) {
260
- throw new AbnfActionError(`abnf: action ref '${key}' matches no ${phase} alt with mark ` +
261
- `'${mark}' in rule '${rule}'`);
262
- }
263
- return { alts, rule };
264
- }
265
- // Attach user semantic actions to a spec, in place. Keys:
266
- // `@<rule>:<phase>` (bo/ao/bc/ac) or `@<rule>:o|c:<mark>`. Values: a
267
- // function or array of functions, run *after* the compiler's own action
268
- // in attachment order. Works in both closure and `builtins` mode — alt
269
- // actions are injected as the engine's array-`a` form (the alt's own
270
- // action, builtin or closure, runs first). Throws `AbnfActionError` for
271
- // a ref matching no rule / hook / marked alt.
272
- function attachActions(spec, actions) {
273
- const ref = (spec.ref = spec.ref ?? {});
274
- let counter = 0;
275
- for (const key of Object.keys(actions)) {
276
- const fns = [].concat(actions[key]);
277
- const target = resolveTarget(spec, key);
278
- if ('phase' in target) {
279
- // Rule-phase hook: reuse the engine's `@<rule>-<phase>` fnref
280
- // auto-install (fnref builds the key from the rule name, so a
281
- // hyphenated ABNF rule name stays unambiguous).
282
- const rule = /^@([^:]+):/.exec(key)[1];
283
- const fkey = `@${rule}-${target.phase}`;
284
- ref[fkey] = composeActions(ref[fkey], fns);
285
- continue;
286
- }
287
- for (const alt of target.alts) {
288
- const userRef = `@abnf_user${counter++}`;
289
- ref[userRef] = seqActions(fns);
290
- alt.a = appendAction(alt.a, userRef);
291
- }
292
- }
293
- return spec;
294
- }
295
- // Declare user-action *slots* on a (pure-data) spec without supplying
296
- // functions: each `@<rule>:o|c:<mark>` ref name is injected into the
297
- // matched alt's array-`a`, to be resolved at load time from a
298
- // user-supplied ref map. Lets a serialized grammar carry user-action
299
- // hooks that the consumer binds by name. Throws on unknown targets.
300
- function attachActionSlots(spec, refNames) {
301
- for (const name of refNames) {
302
- const target = resolveTarget(spec, name);
303
- if ('phase' in target) {
304
- throw new AbnfActionError(`abnf: slot '${name}' is a rule-phase ref; slots are for ` +
305
- `@rule:o|c:mark alt actions`);
306
- }
307
- for (const alt of target.alts)
308
- alt.a = appendAction(alt.a, name);
309
- }
310
- return spec;
311
- }
312
- // Human-readable listing of the marks the compiler assigned, for
313
- // discoverability (CLI `--marks`).
314
- function markListing(spec) {
315
- const lines = [];
316
- const rules = spec.rule ?? {};
317
- for (const rule of Object.keys(rules)) {
318
- for (const [ph, sym] of [['open', 'o'], ['close', 'c']]) {
319
- const f = rules[rule][ph];
320
- const list = Array.isArray(f) ? f : (f && f.alts) || [];
321
- for (const a of list) {
322
- if (a && null != a.m) {
323
- const what = a.s ? `s:${a.s}` : a.p ? `p:${a.p}` : '(empty)';
324
- lines.push(`${rule} ${sym}:${a.m} ${what}`);
325
- }
326
- }
327
- }
328
- }
329
- return lines.join('\n');
330
- }
331
16
  // Compile ABNF source into a pure-data tabnas grammar as jsonic text.
332
17
  // Always converts with `builtins: true` so probe dispatch and tree
333
18
  // building serialise as `@…$` builtin refs (no closures).
334
19
  function abnfCompile(src, opts = {}) {
335
20
  const spec = (0, converter_1.abnf)(src, { start: opts.start, tag: opts.tag, builtins: true, marks: true });
336
- const out = (false === opts.recognition)
337
- ? toPureSpec(spec)
338
- : toRecognitionSpec(spec);
339
- return toJsonic(out, { strict: opts.strict, indent: opts.indent });
21
+ return (0, bnf_1.compileSpec)(spec, opts);
340
22
  }
341
23
  //# sourceMappingURL=compile.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"compile.js","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":";AAAA,2EAA2E;;;AAwH3E,8CAsBC;AAOD,gCAaC;AAcD,4BA4CC;AA6FD,sCA0BC;AAOD,8CAWC;AAID,kCAgBC;AAcD,kCAOC;AAxXD,2CAAuD;AAEvD,2CAAqE;AAGrE,qEAAqE;AACrE,uDAAuD;AACvD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;AAE7C,mEAAmE;AACnE,qEAAqE;AACrE,4BAA4B;AAC5B,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAA;AAC5E,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;AAGvD,MAAa,gBAAiB,SAAQ,KAAK;IAEzC,YAAY,OAAe,EAAE,KAAe;QAC1C,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAA;QAC9B,IAAI,C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AAE,OAA2B,EAAE;IACpE,MAAM,IAAI,GAAgB,IAAA,gBAAW,EAAC,GAAG,EACvC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IACpE,OAAO,IAAA,iBAAW,EAAC,IAAI,EAAE,IAAI,CAAC,CAAA;AAChC,CAAC"}
@@ -1,87 +1,17 @@
1
1
  import type { GrammarSpec, Rule } from '@tabnas/parser';
2
- export type AbnfConvertOptions = {
3
- start?: string;
4
- tag?: string;
5
- builtins?: boolean;
6
- marks?: boolean;
7
- wordKeywords?: boolean;
8
- };
9
- type AbnfElement = {
10
- kind: 'term';
11
- literal: string;
12
- caseSensitive?: boolean;
13
- tokenName?: string;
14
- } | {
15
- kind: 'ref';
16
- name: string;
17
- } | {
18
- kind: 'token';
19
- name: string;
20
- } | {
21
- kind: 'prose';
22
- text: string;
23
- } | {
24
- kind: 'regex';
25
- pattern: string;
26
- flags: string;
27
- } | {
28
- kind: 'opt';
29
- inner: AbnfElement;
30
- } | {
31
- kind: 'star';
32
- inner: AbnfElement;
33
- } | {
34
- kind: 'plus';
35
- inner: AbnfElement;
36
- } | {
37
- kind: 'rep';
38
- min: number;
39
- max: number;
40
- inner: AbnfElement;
41
- } | {
42
- kind: 'group';
43
- alts: AbnfSequence[];
44
- };
45
- type AbnfSequence = AbnfElement[];
46
- type AbnfProduction = {
47
- name: string;
48
- alts: AbnfSequence[];
49
- incremental?: boolean;
50
- tailRepeat?: {
51
- sep: AbnfSequence;
52
- };
53
- probeDispatch?: ProbeDispatchSpec;
54
- probeHelper?: {
55
- vocabElements: AbnfElement[];
56
- };
57
- nodeKind?: 'user' | 'core' | 'helper';
58
- };
59
- type ProbeDispatchSpec = {
60
- probeRule: string;
61
- disambiguator: AbnfElement;
62
- withBranch: string;
63
- noBranch: string;
64
- };
65
- type AbnfGrammar = {
66
- productions: AbnfProduction[];
67
- ambiguities?: AmbiguityReport[];
68
- remove?: string[];
69
- clearAll?: boolean;
70
- };
71
- type AmbiguityReport = {
72
- rule: string;
73
- altIdx: number;
74
- optIdx: number;
75
- reason: string;
76
- resolved: boolean;
77
- };
2
+ import { eliminateLeftRecursion } from '@tabnas/bnf';
3
+ import type { ConvertOptions, Element, Sequence, Production, Grammar } from '@tabnas/bnf';
4
+ type AbnfConvertOptions = ConvertOptions;
5
+ type AbnfElement = Element;
6
+ type AbnfSequence = Sequence;
7
+ type AbnfProduction = Production;
8
+ type AbnfGrammar = Grammar;
78
9
  declare const abnfRules: Record<string, {
79
10
  bo?: (r: Rule) => void;
80
11
  bc?: (r: Rule) => void;
81
12
  open?: any[];
82
13
  close?: any[];
83
14
  }>;
84
- declare function eliminateLeftRecursion(grammar: AbnfGrammar): AbnfGrammar;
85
15
  declare class AbnfParseError extends Error {
86
16
  readonly line?: number;
87
17
  readonly column?: number;
@@ -95,3 +25,4 @@ declare function parseAbnf(src: string): AbnfGrammar;
95
25
  declare function emitGrammarSpec(grammar: AbnfGrammar, opts?: AbnfConvertOptions): GrammarSpec;
96
26
  declare function abnf(src: string, opts?: AbnfConvertOptions): GrammarSpec;
97
27
  export { abnf, parseAbnf, emitGrammarSpec, eliminateLeftRecursion, abnfRules, AbnfParseError, };
28
+ export type { AbnfConvertOptions, AbnfElement, AbnfSequence, AbnfProduction, AbnfGrammar, };