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.browser.js +6 -4
- package/dist/index.browser.js.map +1 -1
- package/dist/index.esm.js +6 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/patterns/Expression.d.ts +1 -0
- package/package.json +1 -1
- package/src/grammar/Grammar.test.ts +14 -0
- package/src/grammar/patterns/decoratorStatement.ts +3 -3
- package/src/patterns/Expression.test.ts +8 -0
- package/src/patterns/Expression.ts +4 -1
package/dist/index.js
CHANGED
|
@@ -2184,12 +2184,12 @@ const openSquareBracket = new Literal("open-square-bracket", "[");
|
|
|
2184
2184
|
const closeSquareBracket = new Literal("close-square-bracket", "]");
|
|
2185
2185
|
const optionalAllSpaces = new Optional("optional-all-spaces", allSpaces);
|
|
2186
2186
|
const stringLiteral = new Regex("string-literal", '"(?:\\\\.|[^"\\\\])*"');
|
|
2187
|
-
const numberLiteral = new Regex("number-literal", '[+-]?\\d+(
|
|
2187
|
+
const numberLiteral = new Regex("number-literal", '[+-]?\\d+(\\.\\d+)?([eE][+-]?\\d+)?');
|
|
2188
2188
|
const nullLiteral = new Literal("null-literal", "null");
|
|
2189
2189
|
const trueLiteral = new Literal("true-literal", "true");
|
|
2190
2190
|
const falseLiteral = new Literal("false-literal", "false");
|
|
2191
2191
|
const booleanLiteral = new Options("", [trueLiteral, falseLiteral]);
|
|
2192
|
-
const objectKey =
|
|
2192
|
+
const objectKey = stringLiteral.clone("object-key");
|
|
2193
2193
|
const objectProperty = new Sequence("object-property", [
|
|
2194
2194
|
objectKey,
|
|
2195
2195
|
optionalAllSpaces,
|
|
@@ -2209,7 +2209,7 @@ const arrayItems = new Repeat("array-items", new Reference("literal"), { divider
|
|
|
2209
2209
|
const arrayLiteral = new Sequence("array-literal", [
|
|
2210
2210
|
openSquareBracket,
|
|
2211
2211
|
optionalAllSpaces,
|
|
2212
|
-
arrayItems,
|
|
2212
|
+
new Optional("optional-array-items", arrayItems),
|
|
2213
2213
|
optionalAllSpaces,
|
|
2214
2214
|
closeSquareBracket,
|
|
2215
2215
|
]);
|
|
@@ -2766,6 +2766,7 @@ class Expression {
|
|
|
2766
2766
|
this._id = `expression-${indexId$1++}`;
|
|
2767
2767
|
this._type = "expression";
|
|
2768
2768
|
this._name = name;
|
|
2769
|
+
this._originalName = name;
|
|
2769
2770
|
this._parent = null;
|
|
2770
2771
|
this._firstIndex = 0;
|
|
2771
2772
|
this._atomPatterns = [];
|
|
@@ -2898,7 +2899,7 @@ class Expression {
|
|
|
2898
2899
|
if (pattern == null) {
|
|
2899
2900
|
return false;
|
|
2900
2901
|
}
|
|
2901
|
-
return pattern.name === this.
|
|
2902
|
+
return pattern.name === this._originalName;
|
|
2902
2903
|
}
|
|
2903
2904
|
build() {
|
|
2904
2905
|
if (!this._hasOrganized) {
|
|
@@ -3130,6 +3131,7 @@ class Expression {
|
|
|
3130
3131
|
}
|
|
3131
3132
|
clone(name = this._name) {
|
|
3132
3133
|
const clone = new Expression(name, this._originalPatterns);
|
|
3134
|
+
clone._originalName = this.name;
|
|
3133
3135
|
clone._id = this._id;
|
|
3134
3136
|
return clone;
|
|
3135
3137
|
}
|