parseman 0.27.0 → 0.28.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 (58) hide show
  1. package/README.md +1 -1
  2. package/dist/combinators/attempt.d.ts +8 -0
  3. package/dist/combinators/attempt.d.ts.map +1 -0
  4. package/dist/combinators/expect.d.ts.map +1 -1
  5. package/dist/combinators/first-set.d.ts.map +1 -1
  6. package/dist/combinators/grammar.d.ts.map +1 -1
  7. package/dist/combinators/node.d.ts +8 -0
  8. package/dist/combinators/node.d.ts.map +1 -1
  9. package/dist/combinators/scanTo.d.ts.map +1 -1
  10. package/dist/combinators/token.d.ts +12 -0
  11. package/dist/combinators/token.d.ts.map +1 -1
  12. package/dist/compiler/build-arity.d.ts +8 -4
  13. package/dist/compiler/build-arity.d.ts.map +1 -1
  14. package/dist/compiler/codegen.d.ts +12 -0
  15. package/dist/compiler/codegen.d.ts.map +1 -1
  16. package/dist/compiler/fields.d.ts +7 -0
  17. package/dist/compiler/fields.d.ts.map +1 -1
  18. package/dist/compiler/grammar-coverage-ids.d.ts +19 -0
  19. package/dist/compiler/grammar-coverage-ids.d.ts.map +1 -0
  20. package/dist/compiler/inline-callback.d.ts.map +1 -1
  21. package/dist/compiler/ir-serialize.d.ts.map +1 -1
  22. package/dist/compiler/linker.d.ts +12 -1
  23. package/dist/compiler/linker.d.ts.map +1 -1
  24. package/dist/compiler/value-usage.d.ts.map +1 -1
  25. package/dist/coverage.d.ts +68 -0
  26. package/dist/coverage.d.ts.map +1 -0
  27. package/dist/cst/trivia-entries.d.ts +2 -0
  28. package/dist/cst/trivia-entries.d.ts.map +1 -1
  29. package/dist/functional/doc.d.ts.map +1 -1
  30. package/dist/functional/run.d.ts +13 -0
  31. package/dist/functional/run.d.ts.map +1 -1
  32. package/dist/index.cjs +936 -103
  33. package/dist/index.cjs.map +4 -4
  34. package/dist/index.d.ts +5 -2
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +936 -103
  37. package/dist/index.js.map +4 -4
  38. package/dist/language-service/index.cjs +7 -2
  39. package/dist/language-service/index.cjs.map +2 -2
  40. package/dist/language-service/index.js +7 -2
  41. package/dist/language-service/index.js.map +2 -2
  42. package/dist/plugin/direct-builder-static.d.ts +8 -0
  43. package/dist/plugin/direct-builder-static.d.ts.map +1 -0
  44. package/dist/plugin/evaluator.d.ts.map +1 -1
  45. package/dist/plugin/index.cjs +1084 -145
  46. package/dist/plugin/index.cjs.map +4 -4
  47. package/dist/plugin/index.d.ts +4 -1
  48. package/dist/plugin/index.d.ts.map +1 -1
  49. package/dist/plugin/index.js +1084 -145
  50. package/dist/plugin/index.js.map +4 -4
  51. package/dist/spec/index.cjs +3 -0
  52. package/dist/spec/index.cjs.map +2 -2
  53. package/dist/spec/index.js +3 -0
  54. package/dist/spec/index.js.map +2 -2
  55. package/dist/spec/model.d.ts.map +1 -1
  56. package/dist/types.d.ts +16 -0
  57. package/dist/types.d.ts.map +1 -1
  58. package/package.json +2 -1
@@ -130,7 +130,8 @@ function runOnce(entry, input, options, phase, profileState) {
130
130
  state: options.state,
131
131
  ...grammarTrivia !== void 0 ? { trivia: grammarTrivia, ...grammarTrivia._meta.triviaKindLabels ? { triviaKindLabels: grammarTrivia._meta.triviaKindLabels } : {} } : {},
132
132
  ...options.triviaCaptureMask !== void 0 ? { _triviaCaptureMask: options.triviaCaptureMask } : {},
133
- ...options.tolerant ? { _tolerant: true, _rec: REC } : {}
133
+ ...options.tolerant ? { _tolerant: true, _rec: REC } : {},
134
+ ...options.instrumentation === void 0 ? {} : options.instrumentation
134
135
  };
135
136
  const r = invoke(entry, input, 0, ctx);
136
137
  let unconsumedFrom = null;
@@ -208,7 +209,7 @@ var META = new Set("()[]{}*+?|^$.".split(""));
208
209
  var CAP_RECORD = [
209
210
  ` if (_cap && _e > _pos) {`,
210
211
  ` if (_ctx._triviaLog !== undefined) _ctx._triviaLog.push(_pos, _e)`,
211
- ` if (_ctx._cstTriviaLog !== undefined) _ctx._cstTriviaLog.push(_pos, _e, _ctx._cstRawChildren ? _ctx._cstRawChildren.length : 0)`,
212
+ ` if (_ctx._cstTriviaLog !== undefined && _ctx.captureTrivia) _ctx._cstTriviaLog.push(_pos, _e, _ctx._cstRawChildren ? _ctx._cstRawChildren.length : 0)`,
212
213
  ` }`
213
214
  ].join("\n");
214
215
 
@@ -230,9 +231,11 @@ function cstBuildHost(typeOrOptions, children, _fields, span, rawChildren, trivi
230
231
  }
231
232
  const collapse = normalizeCstCollapse(typeOrOptions?.collapse);
232
233
  const host = (type, children2, fields, span2, rawChildren2, triviaLog2, state2) => buildCstNode(type, children2, fields, span2, rawChildren2, triviaLog2, state2);
234
+ host._parsemanCstOutput = true;
233
235
  if (collapse) host._parsemanCstCollapse = collapse;
234
236
  return host;
235
237
  }
238
+ cstBuildHost._parsemanCstOutput = true;
236
239
 
237
240
  // src/cst/walk.ts
238
241
  function walk(root, visitor, ctx = void 0) {
@@ -310,7 +313,9 @@ function producesRepetition(def, depth = 0) {
310
313
  // Transparent wrappers — look through to the inner parser.
311
314
  case "node":
312
315
  case "transform":
316
+ case "attempt":
313
317
  case "token":
318
+ case "leaf":
314
319
  case "label":
315
320
  case "field":
316
321
  case "expect":