@bcts/envelope-pattern 1.0.0-alpha.15 → 1.0.0-alpha.17

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 (40) hide show
  1. package/README.md +1 -1
  2. package/dist/index.cjs +485 -485
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +93 -29
  5. package/dist/index.d.cts.map +1 -1
  6. package/dist/index.d.mts +93 -29
  7. package/dist/index.d.mts.map +1 -1
  8. package/dist/index.iife.js +485 -485
  9. package/dist/index.iife.js.map +1 -1
  10. package/dist/index.mjs +504 -504
  11. package/dist/index.mjs.map +1 -1
  12. package/package.json +9 -9
  13. package/src/format.ts +9 -9
  14. package/src/parse/token.ts +55 -55
  15. package/src/pattern/leaf/array-pattern.ts +25 -25
  16. package/src/pattern/leaf/bool-pattern.ts +11 -11
  17. package/src/pattern/leaf/byte-string-pattern.ts +14 -14
  18. package/src/pattern/leaf/cbor-pattern.ts +29 -29
  19. package/src/pattern/leaf/date-pattern.ts +8 -8
  20. package/src/pattern/leaf/known-value-pattern.ts +17 -17
  21. package/src/pattern/leaf/map-pattern.ts +13 -13
  22. package/src/pattern/leaf/null-pattern.ts +7 -7
  23. package/src/pattern/leaf/number-pattern.ts +19 -19
  24. package/src/pattern/leaf/tagged-pattern.ts +20 -20
  25. package/src/pattern/leaf/text-pattern.ts +13 -13
  26. package/src/pattern/meta/and-pattern.ts +11 -11
  27. package/src/pattern/meta/capture-pattern.ts +14 -14
  28. package/src/pattern/meta/group-pattern.ts +13 -13
  29. package/src/pattern/meta/not-pattern.ts +7 -7
  30. package/src/pattern/meta/or-pattern.ts +15 -15
  31. package/src/pattern/meta/search-pattern.ts +15 -15
  32. package/src/pattern/meta/traverse-pattern.ts +15 -15
  33. package/src/pattern/structure/assertions-pattern.ts +28 -28
  34. package/src/pattern/structure/digest-pattern.ts +23 -23
  35. package/src/pattern/structure/node-pattern.ts +17 -17
  36. package/src/pattern/structure/object-pattern.ts +13 -13
  37. package/src/pattern/structure/obscured-pattern.ts +7 -7
  38. package/src/pattern/structure/predicate-pattern.ts +13 -13
  39. package/src/pattern/structure/subject-pattern.ts +15 -15
  40. package/src/pattern/structure/wrapped-pattern.ts +15 -15
@@ -39,10 +39,10 @@ export function registerByteStringPatternFactory(
39
39
  * Corresponds to the Rust `ByteStringPattern` struct in byte_string_pattern.rs
40
40
  */
41
41
  export class ByteStringPattern implements Matcher {
42
- readonly #inner: DCBORByteStringPattern;
42
+ private readonly _inner: DCBORByteStringPattern;
43
43
 
44
44
  private constructor(inner: DCBORByteStringPattern) {
45
- this.#inner = inner;
45
+ this._inner = inner;
46
46
  }
47
47
 
48
48
  /**
@@ -77,7 +77,7 @@ export class ByteStringPattern implements Matcher {
77
77
  * Gets the underlying dcbor-pattern ByteStringPattern.
78
78
  */
79
79
  get inner(): DCBORByteStringPattern {
80
- return this.#inner;
80
+ return this._inner;
81
81
  }
82
82
 
83
83
  pathsWithCaptures(haystack: Envelope): [Path[], Map<string, Path[]>] {
@@ -85,7 +85,7 @@ export class ByteStringPattern implements Matcher {
85
85
  const cbor = haystack.asLeaf();
86
86
  if (cbor !== undefined) {
87
87
  // Delegate to dcbor-pattern for CBOR matching
88
- const dcborPaths = dcborByteStringPatternPaths(this.#inner, cbor);
88
+ const dcborPaths = dcborByteStringPatternPaths(this._inner, cbor);
89
89
 
90
90
  // For simple leaf patterns, if dcbor-pattern found matches, return the envelope
91
91
  if (dcborPaths.length > 0) {
@@ -117,22 +117,22 @@ export class ByteStringPattern implements Matcher {
117
117
  }
118
118
 
119
119
  toString(): string {
120
- return byteStringPatternDisplay(this.#inner);
120
+ return byteStringPatternDisplay(this._inner);
121
121
  }
122
122
 
123
123
  /**
124
124
  * Equality comparison.
125
125
  */
126
126
  equals(other: ByteStringPattern): boolean {
127
- if (this.#inner.variant !== other.#inner.variant) {
127
+ if (this._inner.variant !== other._inner.variant) {
128
128
  return false;
129
129
  }
130
- switch (this.#inner.variant) {
130
+ switch (this._inner.variant) {
131
131
  case "Any":
132
132
  return true;
133
133
  case "Value": {
134
- const a = (this.#inner as { value: Uint8Array }).value;
135
- const b = (other.#inner as { value: Uint8Array }).value;
134
+ const a = (this._inner as { value: Uint8Array }).value;
135
+ const b = (other._inner as { value: Uint8Array }).value;
136
136
  if (a.length !== b.length) return false;
137
137
  for (let i = 0; i < a.length; i++) {
138
138
  if (a[i] !== b[i]) return false;
@@ -141,8 +141,8 @@ export class ByteStringPattern implements Matcher {
141
141
  }
142
142
  case "BinaryRegex":
143
143
  return (
144
- (this.#inner as { pattern: RegExp }).pattern.source ===
145
- (other.#inner as { pattern: RegExp }).pattern.source
144
+ (this._inner as { pattern: RegExp }).pattern.source ===
145
+ (other._inner as { pattern: RegExp }).pattern.source
146
146
  );
147
147
  }
148
148
  }
@@ -152,19 +152,19 @@ export class ByteStringPattern implements Matcher {
152
152
  */
153
153
  hashCode(): number {
154
154
  let hash = 0;
155
- switch (this.#inner.variant) {
155
+ switch (this._inner.variant) {
156
156
  case "Any":
157
157
  hash = 1;
158
158
  break;
159
159
  case "Value": {
160
- const val = (this.#inner as { value: Uint8Array }).value;
160
+ const val = (this._inner as { value: Uint8Array }).value;
161
161
  for (const byte of val) {
162
162
  hash = hash * 31 + byte;
163
163
  }
164
164
  break;
165
165
  }
166
166
  case "BinaryRegex":
167
- hash = 3 * 31 + (this.#inner as { pattern: RegExp }).pattern.source.length;
167
+ hash = 3 * 31 + (this._inner as { pattern: RegExp }).pattern.source.length;
168
168
  break;
169
169
  }
170
170
  return hash;
@@ -43,10 +43,10 @@ export type CBORPatternType =
43
43
  * Corresponds to the Rust `CBORPattern` enum in cbor_pattern.rs
44
44
  */
45
45
  export class CBORPattern implements Matcher {
46
- readonly #pattern: CBORPatternType;
46
+ private readonly _pattern: CBORPatternType;
47
47
 
48
48
  private constructor(pattern: CBORPatternType) {
49
- this.#pattern = pattern;
49
+ this._pattern = pattern;
50
50
  }
51
51
 
52
52
  /**
@@ -81,13 +81,13 @@ export class CBORPattern implements Matcher {
81
81
  * Gets the pattern type.
82
82
  */
83
83
  get pattern(): CBORPatternType {
84
- return this.#pattern;
84
+ return this._pattern;
85
85
  }
86
86
 
87
87
  /**
88
88
  * Convert dcbor captures to envelope captures.
89
89
  */
90
- #convertDcborCapturesToEnvelopeCaptures(
90
+ private _convertDcborCapturesToEnvelopeCaptures(
91
91
  dcborCaptures: Map<string, Cbor[][]>,
92
92
  baseEnvelope: Envelope,
93
93
  baseCbor: Cbor,
@@ -96,7 +96,7 @@ export class CBORPattern implements Matcher {
96
96
 
97
97
  for (const [captureName, dcborCapturePaths] of dcborCaptures) {
98
98
  const envelopeCapturePaths: Path[] = dcborCapturePaths.map((dcborPath) =>
99
- this.#convertDcborPathToEnvelopePath(dcborPath, baseEnvelope, baseCbor),
99
+ this._convertDcborPathToEnvelopePath(dcborPath, baseEnvelope, baseCbor),
100
100
  );
101
101
  envelopeCaptures.set(captureName, envelopeCapturePaths);
102
102
  }
@@ -107,7 +107,7 @@ export class CBORPattern implements Matcher {
107
107
  /**
108
108
  * Convert a single dcbor path to an envelope path.
109
109
  */
110
- #convertDcborPathToEnvelopePath(
110
+ private _convertDcborPathToEnvelopePath(
111
111
  dcborPath: Cbor[],
112
112
  baseEnvelope: Envelope,
113
113
  baseCbor: Cbor,
@@ -131,7 +131,7 @@ export class CBORPattern implements Matcher {
131
131
  /**
132
132
  * Collect capture names from a dcbor pattern.
133
133
  */
134
- #collectDcborCaptureNames(dcborPattern: DCBORPattern, names: string[]): void {
134
+ private _collectDcborCaptureNames(dcborPattern: DCBORPattern, names: string[]): void {
135
135
  // Parse the pattern string to extract capture names
136
136
  const patternStr = dcborPatternDisplay(dcborPattern);
137
137
 
@@ -163,19 +163,19 @@ export class CBORPattern implements Matcher {
163
163
  const knownValue = envCase.value;
164
164
  const knownValueCbor = knownValue.taggedCbor();
165
165
 
166
- switch (this.#pattern.type) {
166
+ switch (this._pattern.type) {
167
167
  case "Any":
168
168
  return [[[haystack]], new Map<string, Path[]>()];
169
169
  case "Value": {
170
170
  // Compare using diagnostic representation
171
- if (knownValueCbor.toDiagnostic() === this.#pattern.cbor.toDiagnostic()) {
171
+ if (knownValueCbor.toDiagnostic() === this._pattern.cbor.toDiagnostic()) {
172
172
  return [[[haystack]], new Map<string, Path[]>()];
173
173
  }
174
174
  return [[], new Map<string, Path[]>()];
175
175
  }
176
176
  case "Pattern": {
177
177
  const { paths: dcborPaths, captures: dcborCaptures } = dcborPatternPathsWithCaptures(
178
- this.#pattern.pattern,
178
+ this._pattern.pattern,
179
179
  knownValueCbor,
180
180
  );
181
181
 
@@ -193,7 +193,7 @@ export class CBORPattern implements Matcher {
193
193
  return extendedPath;
194
194
  });
195
195
 
196
- const envelopeCaptures = this.#convertDcborCapturesToEnvelopeCaptures(
196
+ const envelopeCaptures = this._convertDcborCapturesToEnvelopeCaptures(
197
197
  dcborCaptures,
198
198
  haystack,
199
199
  knownValueCbor,
@@ -211,20 +211,20 @@ export class CBORPattern implements Matcher {
211
211
  return [[], new Map<string, Path[]>()];
212
212
  }
213
213
 
214
- switch (this.#pattern.type) {
214
+ switch (this._pattern.type) {
215
215
  case "Any":
216
216
  return [[[haystack]], new Map<string, Path[]>()];
217
217
 
218
218
  case "Value":
219
219
  // Compare using diagnostic representation
220
- if (leafCbor.toDiagnostic() === this.#pattern.cbor.toDiagnostic()) {
220
+ if (leafCbor.toDiagnostic() === this._pattern.cbor.toDiagnostic()) {
221
221
  return [[[haystack]], new Map<string, Path[]>()];
222
222
  }
223
223
  return [[], new Map<string, Path[]>()];
224
224
 
225
225
  case "Pattern": {
226
226
  const { paths: dcborPaths, captures: dcborCaptures } = dcborPatternPathsWithCaptures(
227
- this.#pattern.pattern,
227
+ this._pattern.pattern,
228
228
  leafCbor,
229
229
  );
230
230
 
@@ -245,7 +245,7 @@ export class CBORPattern implements Matcher {
245
245
  return extendedPath;
246
246
  });
247
247
 
248
- const envelopeCaptures = this.#convertDcborCapturesToEnvelopeCaptures(
248
+ const envelopeCaptures = this._convertDcborCapturesToEnvelopeCaptures(
249
249
  dcborCaptures,
250
250
  haystack,
251
251
  leafCbor,
@@ -267,9 +267,9 @@ export class CBORPattern implements Matcher {
267
267
 
268
268
  compile(code: Instr[], literals: Pattern[], captures: string[]): void {
269
269
  // Register any capture names from this CBOR pattern
270
- if (this.#pattern.type === "Pattern") {
270
+ if (this._pattern.type === "Pattern") {
271
271
  const captureNames: string[] = [];
272
- this.#collectDcborCaptureNames(this.#pattern.pattern, captureNames);
272
+ this._collectDcborCaptureNames(this._pattern.pattern, captureNames);
273
273
  for (const name of captureNames) {
274
274
  if (!captures.includes(name)) {
275
275
  captures.push(name);
@@ -288,13 +288,13 @@ export class CBORPattern implements Matcher {
288
288
  }
289
289
 
290
290
  toString(): string {
291
- switch (this.#pattern.type) {
291
+ switch (this._pattern.type) {
292
292
  case "Any":
293
293
  return "cbor";
294
294
  case "Value":
295
- return `cbor(${this.#pattern.cbor.toDiagnostic()})`;
295
+ return `cbor(${this._pattern.cbor.toDiagnostic()})`;
296
296
  case "Pattern":
297
- return `cbor(/${dcborPatternDisplay(this.#pattern.pattern)}/)`;
297
+ return `cbor(/${dcborPatternDisplay(this._pattern.pattern)}/)`;
298
298
  }
299
299
  }
300
300
 
@@ -302,24 +302,24 @@ export class CBORPattern implements Matcher {
302
302
  * Equality comparison.
303
303
  */
304
304
  equals(other: CBORPattern): boolean {
305
- if (this.#pattern.type !== other.#pattern.type) {
305
+ if (this._pattern.type !== other._pattern.type) {
306
306
  return false;
307
307
  }
308
- switch (this.#pattern.type) {
308
+ switch (this._pattern.type) {
309
309
  case "Any":
310
310
  return true;
311
311
  case "Value":
312
312
  // Compare using diagnostic representation
313
313
  return (
314
- this.#pattern.cbor.toDiagnostic() ===
315
- (other.#pattern as { type: "Value"; cbor: Cbor }).cbor.toDiagnostic()
314
+ this._pattern.cbor.toDiagnostic() ===
315
+ (other._pattern as { type: "Value"; cbor: Cbor }).cbor.toDiagnostic()
316
316
  );
317
317
  case "Pattern":
318
318
  // Compare using display representation
319
319
  return (
320
- dcborPatternDisplay(this.#pattern.pattern) ===
320
+ dcborPatternDisplay(this._pattern.pattern) ===
321
321
  dcborPatternDisplay(
322
- (other.#pattern as { type: "Pattern"; pattern: DCBORPattern }).pattern,
322
+ (other._pattern as { type: "Pattern"; pattern: DCBORPattern }).pattern,
323
323
  )
324
324
  );
325
325
  }
@@ -329,15 +329,15 @@ export class CBORPattern implements Matcher {
329
329
  * Hash code for use in Maps/Sets.
330
330
  */
331
331
  hashCode(): number {
332
- switch (this.#pattern.type) {
332
+ switch (this._pattern.type) {
333
333
  case "Any":
334
334
  return 0;
335
335
  case "Value":
336
336
  // Simple hash based on diagnostic string
337
- return simpleStringHash(this.#pattern.cbor.toDiagnostic());
337
+ return simpleStringHash(this._pattern.cbor.toDiagnostic());
338
338
  case "Pattern":
339
339
  // Simple hash based on display string
340
- return simpleStringHash(dcborPatternDisplay(this.#pattern.pattern));
340
+ return simpleStringHash(dcborPatternDisplay(this._pattern.pattern));
341
341
  }
342
342
  }
343
343
  }
@@ -42,10 +42,10 @@ export function registerDatePatternFactory(factory: (pattern: DatePattern) => Pa
42
42
  * Corresponds to the Rust `DatePattern` struct in date_pattern.rs
43
43
  */
44
44
  export class DatePattern implements Matcher {
45
- readonly #inner: DCBORDatePattern;
45
+ private readonly _inner: DCBORDatePattern;
46
46
 
47
47
  private constructor(inner: DCBORDatePattern) {
48
- this.#inner = inner;
48
+ this._inner = inner;
49
49
  }
50
50
 
51
51
  /**
@@ -109,7 +109,7 @@ export class DatePattern implements Matcher {
109
109
  * Gets the underlying dcbor-pattern DatePattern.
110
110
  */
111
111
  get inner(): DCBORDatePattern {
112
- return this.#inner;
112
+ return this._inner;
113
113
  }
114
114
 
115
115
  pathsWithCaptures(haystack: Envelope): [Path[], Map<string, Path[]>] {
@@ -117,7 +117,7 @@ export class DatePattern implements Matcher {
117
117
  const cbor = haystack.asLeaf();
118
118
  if (cbor !== undefined) {
119
119
  // Delegate to dcbor-pattern for CBOR matching
120
- const dcborPaths = dcborDatePatternPaths(this.#inner, cbor);
120
+ const dcborPaths = dcborDatePatternPaths(this._inner, cbor);
121
121
 
122
122
  // For simple leaf patterns, if dcbor-pattern found matches, return the envelope
123
123
  if (dcborPaths.length > 0) {
@@ -149,18 +149,18 @@ export class DatePattern implements Matcher {
149
149
  }
150
150
 
151
151
  toString(): string {
152
- return datePatternDisplay(this.#inner);
152
+ return datePatternDisplay(this._inner);
153
153
  }
154
154
 
155
155
  /**
156
156
  * Equality comparison.
157
157
  */
158
158
  equals(other: DatePattern): boolean {
159
- if (this.#inner.variant !== other.#inner.variant) {
159
+ if (this._inner.variant !== other._inner.variant) {
160
160
  return false;
161
161
  }
162
162
  // Simplified equality - compare variant names
163
- return JSON.stringify(this.#inner) === JSON.stringify(other.#inner);
163
+ return JSON.stringify(this._inner) === JSON.stringify(other._inner);
164
164
  }
165
165
 
166
166
  /**
@@ -169,7 +169,7 @@ export class DatePattern implements Matcher {
169
169
  hashCode(): number {
170
170
  // Simple hash based on variant
171
171
  let hash = 0;
172
- const str = this.#inner.variant;
172
+ const str = this._inner.variant;
173
173
  for (let i = 0; i < str.length; i++) {
174
174
  hash = hash * 31 + str.charCodeAt(i);
175
175
  }
@@ -41,10 +41,10 @@ export function registerKnownValuePatternFactory(
41
41
  * Corresponds to the Rust `KnownValuePattern` struct in known_value_pattern.rs
42
42
  */
43
43
  export class KnownValuePattern implements Matcher {
44
- readonly #inner: DCBORKnownValuePattern;
44
+ private readonly _inner: DCBORKnownValuePattern;
45
45
 
46
46
  private constructor(inner: DCBORKnownValuePattern) {
47
- this.#inner = inner;
47
+ this._inner = inner;
48
48
  }
49
49
 
50
50
  /**
@@ -86,7 +86,7 @@ export class KnownValuePattern implements Matcher {
86
86
  * Gets the underlying dcbor-pattern KnownValuePattern.
87
87
  */
88
88
  get inner(): DCBORKnownValuePattern {
89
- return this.#inner;
89
+ return this._inner;
90
90
  }
91
91
 
92
92
  pathsWithCaptures(haystack: Envelope): [Path[], Map<string, Path[]>] {
@@ -96,7 +96,7 @@ export class KnownValuePattern implements Matcher {
96
96
  if (envCase.type === "knownValue") {
97
97
  // Get the KnownValue and create CBOR for pattern matching
98
98
  const knownValueCbor = envCase.value.taggedCbor();
99
- if (knownValuePatternMatches(this.#inner, knownValueCbor)) {
99
+ if (knownValuePatternMatches(this._inner, knownValueCbor)) {
100
100
  return [[[haystack]], new Map<string, Path[]>()];
101
101
  }
102
102
  }
@@ -104,7 +104,7 @@ export class KnownValuePattern implements Matcher {
104
104
  // Also try matching as a leaf (for tagged CBOR containing known values)
105
105
  const leafCbor = haystack.asLeaf();
106
106
  if (leafCbor !== undefined) {
107
- if (knownValuePatternMatches(this.#inner, leafCbor)) {
107
+ if (knownValuePatternMatches(this._inner, leafCbor)) {
108
108
  return [[[haystack]], new Map<string, Path[]>()];
109
109
  }
110
110
  }
@@ -132,7 +132,7 @@ export class KnownValuePattern implements Matcher {
132
132
  }
133
133
 
134
134
  toString(): string {
135
- return knownValuePatternDisplay(this.#inner);
135
+ return knownValuePatternDisplay(this._inner);
136
136
  }
137
137
 
138
138
  /**
@@ -140,23 +140,23 @@ export class KnownValuePattern implements Matcher {
140
140
  */
141
141
  equals(other: KnownValuePattern): boolean {
142
142
  // Compare by variant type and values
143
- if (this.#inner.variant !== other.#inner.variant) {
143
+ if (this._inner.variant !== other._inner.variant) {
144
144
  return false;
145
145
  }
146
- switch (this.#inner.variant) {
146
+ switch (this._inner.variant) {
147
147
  case "Any":
148
148
  return true;
149
149
  case "Value":
150
150
  return (
151
- this.#inner.value.valueBigInt() ===
152
- (other.#inner as { variant: "Value"; value: KnownValue }).value.valueBigInt()
151
+ this._inner.value.valueBigInt() ===
152
+ (other._inner as { variant: "Value"; value: KnownValue }).value.valueBigInt()
153
153
  );
154
154
  case "Named":
155
- return this.#inner.name === (other.#inner as { variant: "Named"; name: string }).name;
155
+ return this._inner.name === (other._inner as { variant: "Named"; name: string }).name;
156
156
  case "Regex":
157
157
  return (
158
- this.#inner.pattern.source ===
159
- (other.#inner as { variant: "Regex"; pattern: RegExp }).pattern.source
158
+ this._inner.pattern.source ===
159
+ (other._inner as { variant: "Regex"; pattern: RegExp }).pattern.source
160
160
  );
161
161
  }
162
162
  }
@@ -165,15 +165,15 @@ export class KnownValuePattern implements Matcher {
165
165
  * Hash code for use in Maps/Sets.
166
166
  */
167
167
  hashCode(): number {
168
- switch (this.#inner.variant) {
168
+ switch (this._inner.variant) {
169
169
  case "Any":
170
170
  return 0;
171
171
  case "Value":
172
- return Number(this.#inner.value.valueBigInt() & BigInt(0xffffffff));
172
+ return Number(this._inner.value.valueBigInt() & BigInt(0xffffffff));
173
173
  case "Named":
174
- return simpleStringHash(this.#inner.name);
174
+ return simpleStringHash(this._inner.name);
175
175
  case "Regex":
176
- return simpleStringHash(this.#inner.pattern.source);
176
+ return simpleStringHash(this._inner.pattern.source);
177
177
  }
178
178
  }
179
179
  }
@@ -37,10 +37,10 @@ export type MapPatternType =
37
37
  * Corresponds to the Rust `MapPattern` struct in map_pattern.rs
38
38
  */
39
39
  export class MapPattern implements Matcher {
40
- readonly #pattern: MapPatternType;
40
+ private readonly _pattern: MapPatternType;
41
41
 
42
42
  private constructor(pattern: MapPatternType) {
43
- this.#pattern = pattern;
43
+ this._pattern = pattern;
44
44
  }
45
45
 
46
46
  /**
@@ -62,7 +62,7 @@ export class MapPattern implements Matcher {
62
62
  * Gets the pattern type.
63
63
  */
64
64
  get pattern(): MapPatternType {
65
- return this.#pattern;
65
+ return this._pattern;
66
66
  }
67
67
 
68
68
  pathsWithCaptures(haystack: Envelope): [Path[], Map<string, Path[]>] {
@@ -78,13 +78,13 @@ export class MapPattern implements Matcher {
78
78
  return [[], new Map<string, Path[]>()];
79
79
  }
80
80
 
81
- switch (this.#pattern.type) {
81
+ switch (this._pattern.type) {
82
82
  case "Any":
83
83
  return [[[haystack]], new Map<string, Path[]>()];
84
84
 
85
85
  case "Interval": {
86
86
  const size = map.size;
87
- if (this.#pattern.interval.contains(size)) {
87
+ if (this._pattern.interval.contains(size)) {
88
88
  return [[[haystack]], new Map<string, Path[]>()];
89
89
  }
90
90
  return [[], new Map<string, Path[]>()];
@@ -112,11 +112,11 @@ export class MapPattern implements Matcher {
112
112
  }
113
113
 
114
114
  toString(): string {
115
- switch (this.#pattern.type) {
115
+ switch (this._pattern.type) {
116
116
  case "Any":
117
117
  return "{*}";
118
118
  case "Interval":
119
- return `{{${this.#pattern.interval.toString()}}}`;
119
+ return `{{${this._pattern.interval.toString()}}}`;
120
120
  }
121
121
  }
122
122
 
@@ -124,15 +124,15 @@ export class MapPattern implements Matcher {
124
124
  * Equality comparison.
125
125
  */
126
126
  equals(other: MapPattern): boolean {
127
- if (this.#pattern.type !== other.#pattern.type) {
127
+ if (this._pattern.type !== other._pattern.type) {
128
128
  return false;
129
129
  }
130
- switch (this.#pattern.type) {
130
+ switch (this._pattern.type) {
131
131
  case "Any":
132
132
  return true;
133
133
  case "Interval":
134
- return this.#pattern.interval.equals(
135
- (other.#pattern as { type: "Interval"; interval: Interval }).interval,
134
+ return this._pattern.interval.equals(
135
+ (other._pattern as { type: "Interval"; interval: Interval }).interval,
136
136
  );
137
137
  }
138
138
  }
@@ -141,12 +141,12 @@ export class MapPattern implements Matcher {
141
141
  * Hash code for use in Maps/Sets.
142
142
  */
143
143
  hashCode(): number {
144
- switch (this.#pattern.type) {
144
+ switch (this._pattern.type) {
145
145
  case "Any":
146
146
  return 0;
147
147
  case "Interval":
148
148
  // Simple hash based on interval min/max
149
- return this.#pattern.interval.min() * 31 + (this.#pattern.interval.max() ?? 0);
149
+ return this._pattern.interval.min() * 31 + (this._pattern.interval.max() ?? 0);
150
150
  }
151
151
  }
152
152
  }
@@ -34,26 +34,26 @@ export function registerNullPatternFactory(factory: (pattern: NullPattern) => Pa
34
34
  * Corresponds to the Rust `NullPattern` struct in null_pattern.rs
35
35
  */
36
36
  export class NullPattern implements Matcher {
37
- readonly #inner: DCBORNullPattern;
38
- static readonly #instance = new NullPattern();
37
+ private readonly _inner: DCBORNullPattern;
38
+ private static readonly _instance = new NullPattern();
39
39
 
40
40
  private constructor() {
41
41
  // Create the NullPattern directly - it's just { variant: "Null" }
42
- this.#inner = { variant: "Null" };
42
+ this._inner = { variant: "Null" };
43
43
  }
44
44
 
45
45
  /**
46
46
  * Creates a new NullPattern (returns singleton).
47
47
  */
48
48
  static new(): NullPattern {
49
- return NullPattern.#instance;
49
+ return NullPattern._instance;
50
50
  }
51
51
 
52
52
  /**
53
53
  * Gets the underlying dcbor-pattern NullPattern.
54
54
  */
55
55
  get inner(): DCBORNullPattern {
56
- return this.#inner;
56
+ return this._inner;
57
57
  }
58
58
 
59
59
  pathsWithCaptures(haystack: Envelope): [Path[], Map<string, Path[]>] {
@@ -61,7 +61,7 @@ export class NullPattern implements Matcher {
61
61
  const cbor = haystack.asLeaf();
62
62
  if (cbor !== undefined) {
63
63
  // Delegate to dcbor-pattern for CBOR matching
64
- const dcborPaths = dcborNullPatternPaths(this.#inner, cbor);
64
+ const dcborPaths = dcborNullPatternPaths(this._inner, cbor);
65
65
 
66
66
  if (dcborPaths.length > 0) {
67
67
  return [[[haystack]], new Map<string, Path[]>()];
@@ -91,7 +91,7 @@ export class NullPattern implements Matcher {
91
91
  }
92
92
 
93
93
  toString(): string {
94
- return nullPatternDisplay(this.#inner);
94
+ return nullPatternDisplay(this._inner);
95
95
  }
96
96
 
97
97
  /**