clarity-pattern-parser 9.2.1 → 9.2.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 +7 -6
- package/dist/index.browser.js.map +1 -1
- package/dist/index.esm.js +7 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/grammar/Grammar.ts +5 -3
- package/src/grammar/patterns/import.ts +1 -1
- package/src/patterns/Options.test.ts +2 -2
- package/src/patterns/Options.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -913,8 +913,8 @@ class Options {
|
|
|
913
913
|
}
|
|
914
914
|
const children = clonePatterns(options);
|
|
915
915
|
this._assignChildrenToParent(children);
|
|
916
|
-
this._id = `
|
|
917
|
-
this._type = "
|
|
916
|
+
this._id = `options-${idIndex$6++}`;
|
|
917
|
+
this._type = "options";
|
|
918
918
|
this._name = name;
|
|
919
919
|
this._parent = null;
|
|
920
920
|
this._children = children;
|
|
@@ -2099,7 +2099,7 @@ const withParamsStatement = new Optional("optional-with-params-statement", new S
|
|
|
2099
2099
|
optionalLineSpaces$1,
|
|
2100
2100
|
openBracket,
|
|
2101
2101
|
optionalSpaces$1,
|
|
2102
|
-
body
|
|
2102
|
+
body,
|
|
2103
2103
|
optionalSpaces$1,
|
|
2104
2104
|
closeBracket
|
|
2105
2105
|
]));
|
|
@@ -2552,11 +2552,12 @@ class Grammar {
|
|
|
2552
2552
|
return importBlock && importBlock.children.length > 0;
|
|
2553
2553
|
}
|
|
2554
2554
|
_buildPatterns(ast) {
|
|
2555
|
-
const body = ast.find(n => n.name === "body");
|
|
2555
|
+
const body = ast.find(n => n.name === "body" && n.findAncester(n => n.name === "head") == null);
|
|
2556
2556
|
if (body == null) {
|
|
2557
2557
|
return;
|
|
2558
2558
|
}
|
|
2559
|
-
body.findAll(n => n.name === "assign-statement")
|
|
2559
|
+
const statements = body.findAll(n => n.name === "assign-statement");
|
|
2560
|
+
statements.forEach((n) => {
|
|
2560
2561
|
const patternNode = n.children.find(n => patternNodes[n.name] != null);
|
|
2561
2562
|
if (patternNode == null) {
|
|
2562
2563
|
return;
|
|
@@ -2818,7 +2819,7 @@ class Grammar {
|
|
|
2818
2819
|
let params = [];
|
|
2819
2820
|
const paramsStatement = importStatement.find(n => n.name === "with-params-statement");
|
|
2820
2821
|
if (paramsStatement != null) {
|
|
2821
|
-
const statements = paramsStatement.find(n => n.name === "
|
|
2822
|
+
const statements = paramsStatement.find(n => n.name === "body");
|
|
2822
2823
|
if (statements != null) {
|
|
2823
2824
|
const expression = statements.toString();
|
|
2824
2825
|
const importedValues = Array.from(this
|