parseman 0.13.0 → 0.14.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 (39) hide show
  1. package/dist/combinators/expect.d.ts.map +1 -1
  2. package/dist/combinators/node.d.ts +1 -1
  3. package/dist/combinators/node.d.ts.map +1 -1
  4. package/dist/combinators/parser.d.ts.map +1 -1
  5. package/dist/combinators/regex-analyze.d.ts +6 -0
  6. package/dist/combinators/regex-analyze.d.ts.map +1 -0
  7. package/dist/combinators/regex.d.ts +16 -1
  8. package/dist/combinators/regex.d.ts.map +1 -1
  9. package/dist/compiler/build-arity.d.ts.map +1 -1
  10. package/dist/compiler/codegen.d.ts +45 -0
  11. package/dist/compiler/codegen.d.ts.map +1 -1
  12. package/dist/compiler/inline-build.d.ts.map +1 -1
  13. package/dist/compiler/linker.d.ts +44 -0
  14. package/dist/compiler/linker.d.ts.map +1 -0
  15. package/dist/compiler/scannable-run.d.ts.map +1 -1
  16. package/dist/cst/offset-model.d.ts +119 -0
  17. package/dist/cst/offset-model.d.ts.map +1 -0
  18. package/dist/cst/relative-spans.d.ts +56 -0
  19. package/dist/cst/relative-spans.d.ts.map +1 -0
  20. package/dist/functional/doc.d.ts +20 -0
  21. package/dist/functional/doc.d.ts.map +1 -1
  22. package/dist/functional/run.d.ts +63 -0
  23. package/dist/functional/run.d.ts.map +1 -0
  24. package/dist/index.cjs +902 -112
  25. package/dist/index.cjs.map +4 -4
  26. package/dist/index.d.ts +9 -1
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +902 -112
  29. package/dist/index.js.map +4 -4
  30. package/dist/plugin/evaluator.d.ts +2 -28
  31. package/dist/plugin/evaluator.d.ts.map +1 -1
  32. package/dist/plugin/index.cjs +710 -250
  33. package/dist/plugin/index.cjs.map +4 -4
  34. package/dist/plugin/index.d.ts.map +1 -1
  35. package/dist/plugin/index.js +710 -250
  36. package/dist/plugin/index.js.map +4 -4
  37. package/dist/types.d.ts +12 -3
  38. package/dist/types.d.ts.map +1 -1
  39. package/package.json +3 -1
@@ -5,7 +5,7 @@
5
5
  * Returns null for anything unresolvable (external variables, template literals,
6
6
  * computed keys, etc.) — callers leave those as-is.
7
7
  */
8
- import type { Expression, Node, ArrowFunctionExpression, Function as OxcFunction } from '@oxc-project/types';
8
+ import type { Expression, Node } from '@oxc-project/types';
9
9
  import type { Combinator } from '../types.ts';
10
10
  export type ScopeEntry = {
11
11
  combi: Combinator<unknown>;
@@ -28,31 +28,6 @@ export declare function evaluateExpr(node: Expression, scope: Scope, code?: stri
28
28
  * literal of statically-resolvable combinators.
29
29
  */
30
30
  export declare function evaluateCombinatorArray(node: Expression, scope: Scope, code?: string): Combinator<unknown>[] | null;
31
- /** A rules() fragment factory AST: an arrow / function returning an object literal. */
32
- export type FactoryAst = ArrowFunctionExpression | OxcFunction;
33
- /**
34
- * A resolved fragment factory + the source text its AST offsets index into. For a
35
- * same-file factory that's the consumer's own `code`; for an imported one it's the
36
- * exporting module's source (read by the plugin). The source MUST travel with the
37
- * AST so callback capture (`node`/`transform` slice `code[start..end]`) reads the
38
- * right bytes — a fragment's node offsets are meaningless against the consumer file.
39
- */
40
- export type ResolvedFactory = {
41
- fn: FactoryAst;
42
- code: string;
43
- };
44
- /**
45
- * Resolve a fragment factory by name — a local same-file `const frag = …` OR an
46
- * imported one whose source the plugin reads (tier 2). Returns null when the name
47
- * isn't a resolvable fragment (→ the spread bails to the interpreter fallback).
48
- */
49
- export type FactoryResolver = (name: string) => ResolvedFactory | null;
50
- /**
51
- * If `expr` is a fragment factory — an arrow/function whose body returns an object
52
- * literal, e.g. `(g, deps) => ({ rule: combinator, … })` — return it (for the macro
53
- * to register and inline into `...frag(g)` spreads). Otherwise null.
54
- */
55
- export declare function asFragmentFactory(expr: Expression): FactoryAst | null;
56
31
  /**
57
32
  * Evaluate a `parser(g => { ... return { ruleName: combinator, ... } })` call.
58
33
  * Returns a map of rule names → defined Combinators, or null if the factory
@@ -68,8 +43,7 @@ export declare function asFragmentFactory(expr: Expression): FactoryAst | null;
68
43
  * The body-phase entries are stored as `mfSrcs` on localScope entries and
69
44
  * replayed when those entries are referenced during return evaluation.
70
45
  */
71
- export declare function evaluateParserFactory(factoryNode: Expression, scope: Scope, code: string, mapFnSources: string[], // receives ONLY the return-expression mfSrcs
72
- resolveFactory?: FactoryResolver): Map<string, Combinator<unknown>> | null;
46
+ export declare function evaluateParserFactory(factoryNode: Expression, scope: Scope, code: string, mapFnSources: string[]): Map<string, Combinator<unknown>> | null;
73
47
  /** A combinator slot created by ref() — has a callable `define`. */
74
48
  type DefinableRef = Combinator<unknown> & {
75
49
  define(p: Combinator<unknown>): void;
@@ -1 +1 @@
1
- {"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../src/plugin/evaluator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EACV,UAAU,EAAE,IAAI,EAChB,uBAAuB,EAAE,QAAQ,IAAI,WAAW,EAKjD,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAa7C,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,CAAA;IAC1B,MAAM,EAAE,MAAM,EAAE,CAAA;CACjB,CAAA;AACD,MAAM,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;AAM3C,KAAK,gBAAgB,GAAG;IAAE,GAAG,EAAE,aAAa,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAA;AAqVhE,0EAA0E;AAC1E,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,KAAK,EACZ,IAAI,CAAC,EAAE,MAAM,GACZ,gBAAgB,GAAG,IAAI,CAUzB;AAED,6EAA6E;AAC7E,wBAAgB,YAAY,CAC1B,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,KAAK,EACZ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