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.browser.js
CHANGED
|
@@ -2186,12 +2186,12 @@
|
|
|
2186
2186
|
const closeSquareBracket = new Literal("close-square-bracket", "]");
|
|
2187
2187
|
const optionalAllSpaces = new Optional("optional-all-spaces", allSpaces);
|
|
2188
2188
|
const stringLiteral = new Regex("string-literal", '"(?:\\\\.|[^"\\\\])*"');
|
|
2189
|
-
const numberLiteral = new Regex("number-literal", '[+-]?\\d+(
|
|
2189
|
+
const numberLiteral = new Regex("number-literal", '[+-]?\\d+(\\.\\d+)?([eE][+-]?\\d+)?');
|
|
2190
2190
|
const nullLiteral = new Literal("null-literal", "null");
|
|
2191
2191
|
const trueLiteral = new Literal("true-literal", "true");
|
|
2192
2192
|
const falseLiteral = new Literal("false-literal", "false");
|
|
2193
2193
|
const booleanLiteral = new Options("", [trueLiteral, falseLiteral]);
|
|
2194
|
-
const objectKey =
|
|
2194
|
+
const objectKey = stringLiteral.clone("object-key");
|
|
2195
2195
|
const objectProperty = new Sequence("object-property", [
|
|
2196
2196
|
objectKey,
|
|
2197
2197
|
optionalAllSpaces,
|
|
@@ -2211,7 +2211,7 @@
|
|
|
2211
2211
|
const arrayLiteral = new Sequence("array-literal", [
|
|
2212
2212
|
openSquareBracket,
|
|
2213
2213
|
optionalAllSpaces,
|
|
2214
|
-
arrayItems,
|
|
2214
|
+
new Optional("optional-array-items", arrayItems),
|
|
2215
2215
|
optionalAllSpaces,
|
|
2216
2216
|
closeSquareBracket,
|
|
2217
2217
|
]);
|
|
@@ -2768,6 +2768,7 @@
|
|
|
2768
2768
|
this._id = `expression-${indexId$1++}`;
|
|
2769
2769
|
this._type = "expression";
|
|
2770
2770
|
this._name = name;
|
|
2771
|
+
this._originalName = name;
|
|
2771
2772
|
this._parent = null;
|
|
2772
2773
|
this._firstIndex = 0;
|
|
2773
2774
|
this._atomPatterns = [];
|
|
@@ -2900,7 +2901,7 @@
|
|
|
2900
2901
|
if (pattern == null) {
|
|
2901
2902
|
return false;
|
|
2902
2903
|
}
|
|
2903
|
-
return pattern.name === this.
|
|
2904
|
+
return pattern.name === this._originalName;
|
|
2904
2905
|
}
|
|
2905
2906
|
build() {
|
|
2906
2907
|
if (!this._hasOrganized) {
|
|
@@ -3132,6 +3133,7 @@
|
|
|
3132
3133
|
}
|
|
3133
3134
|
clone(name = this._name) {
|
|
3134
3135
|
const clone = new Expression(name, this._originalPatterns);
|
|
3136
|
+
clone._originalName = this.name;
|
|
3135
3137
|
clone._id = this._id;
|
|
3136
3138
|
return clone;
|
|
3137
3139
|
}
|