clarity-pattern-parser 11.1.0 → 11.1.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/index.esm.js CHANGED
@@ -2180,12 +2180,12 @@ const openSquareBracket = new Literal("open-square-bracket", "[");
2180
2180
  const closeSquareBracket = new Literal("close-square-bracket", "]");
2181
2181
  const optionalAllSpaces = new Optional("optional-all-spaces", allSpaces);
2182
2182
  const stringLiteral = new Regex("string-literal", '"(?:\\\\.|[^"\\\\])*"');
2183
- const numberLiteral = new Regex("number-literal", '[+-]?\\d+(\\\\.\\d+)?([eE][+-]?\\d+)?');
2183
+ const numberLiteral = new Regex("number-literal", '[+-]?\\d+(\\.\\d+)?([eE][+-]?\\d+)?');
2184
2184
  const nullLiteral = new Literal("null-literal", "null");
2185
2185
  const trueLiteral = new Literal("true-literal", "true");
2186
2186
  const falseLiteral = new Literal("false-literal", "false");
2187
2187
  const booleanLiteral = new Options("", [trueLiteral, falseLiteral]);
2188
- const objectKey = name$1.clone("object-key");
2188
+ const objectKey = stringLiteral.clone("object-key");
2189
2189
  const objectProperty = new Sequence("object-property", [
2190
2190
  objectKey,
2191
2191
  optionalAllSpaces,
@@ -2205,7 +2205,7 @@ const arrayItems = new Repeat("array-items", new Reference("literal"), { divider
2205
2205
  const arrayLiteral = new Sequence("array-literal", [
2206
2206
  openSquareBracket,
2207
2207
  optionalAllSpaces,
2208
- arrayItems,
2208
+ new Optional("optional-array-items", arrayItems),
2209
2209
  optionalAllSpaces,
2210
2210
  closeSquareBracket,
2211
2211
  ]);
@@ -2762,6 +2762,7 @@ class Expression {
2762
2762
  this._id = `expression-${indexId$1++}`;
2763
2763
  this._type = "expression";
2764
2764
  this._name = name;
2765
+ this._originalName = name;
2765
2766
  this._parent = null;
2766
2767
  this._firstIndex = 0;
2767
2768
  this._atomPatterns = [];
@@ -2894,7 +2895,7 @@ class Expression {
2894
2895
  if (pattern == null) {
2895
2896
  return false;
2896
2897
  }
2897
- return pattern.name === this.name;
2898
+ return pattern.name === this._originalName;
2898
2899
  }
2899
2900
  build() {
2900
2901
  if (!this._hasOrganized) {
@@ -3126,6 +3127,7 @@ class Expression {
3126
3127
  }
3127
3128
  clone(name = this._name) {
3128
3129
  const clone = new Expression(name, this._originalPatterns);
3130
+ clone._originalName = this.name;
3129
3131
  clone._id = this._id;
3130
3132
  return clone;
3131
3133
  }