clarity-pattern-parser 9.2.1 → 9.2.3
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 +9 -7
- package/dist/index.browser.js.map +1 -1
- package/dist/index.esm.js +9 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/grammar/Grammar.test.ts +3 -1
- package/src/grammar/Grammar.ts +5 -3
- package/src/grammar/patterns/body.ts +3 -2
- package/src/grammar/patterns/import.ts +1 -1
- package/src/grammar/patterns.test.ts +1 -1
- package/src/patterns/Options.test.ts +2 -2
- package/src/patterns/Options.ts +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -909,8 +909,8 @@ class Options {
|
|
|
909
909
|
}
|
|
910
910
|
const children = clonePatterns(options);
|
|
911
911
|
this._assignChildrenToParent(children);
|
|
912
|
-
this._id = `
|
|
913
|
-
this._type = "
|
|
912
|
+
this._id = `options-${idIndex$6++}`;
|
|
913
|
+
this._type = "options";
|
|
914
914
|
this._name = name;
|
|
915
915
|
this._parent = null;
|
|
916
916
|
this._children = children;
|
|
@@ -2052,7 +2052,8 @@ const statement = new Options("statement", [assignStatement, name$1.clone("expor
|
|
|
2052
2052
|
|
|
2053
2053
|
const bodyLineContent = new Options("body-line-content", [
|
|
2054
2054
|
comment,
|
|
2055
|
-
statement
|
|
2055
|
+
statement,
|
|
2056
|
+
lineSpaces$1
|
|
2056
2057
|
]);
|
|
2057
2058
|
const optionalLineSpaces$2 = new Optional("optional-line-spaces", lineSpaces$1);
|
|
2058
2059
|
const bodyLine = new Sequence("body-line", [
|
|
@@ -2095,7 +2096,7 @@ const withParamsStatement = new Optional("optional-with-params-statement", new S
|
|
|
2095
2096
|
optionalLineSpaces$1,
|
|
2096
2097
|
openBracket,
|
|
2097
2098
|
optionalSpaces$1,
|
|
2098
|
-
body
|
|
2099
|
+
body,
|
|
2099
2100
|
optionalSpaces$1,
|
|
2100
2101
|
closeBracket
|
|
2101
2102
|
]));
|
|
@@ -2548,11 +2549,12 @@ class Grammar {
|
|
|
2548
2549
|
return importBlock && importBlock.children.length > 0;
|
|
2549
2550
|
}
|
|
2550
2551
|
_buildPatterns(ast) {
|
|
2551
|
-
const body = ast.find(n => n.name === "body");
|
|
2552
|
+
const body = ast.find(n => n.name === "body" && n.findAncester(n => n.name === "head") == null);
|
|
2552
2553
|
if (body == null) {
|
|
2553
2554
|
return;
|
|
2554
2555
|
}
|
|
2555
|
-
body.findAll(n => n.name === "assign-statement")
|
|
2556
|
+
const statements = body.findAll(n => n.name === "assign-statement");
|
|
2557
|
+
statements.forEach((n) => {
|
|
2556
2558
|
const patternNode = n.children.find(n => patternNodes[n.name] != null);
|
|
2557
2559
|
if (patternNode == null) {
|
|
2558
2560
|
return;
|
|
@@ -2814,7 +2816,7 @@ class Grammar {
|
|
|
2814
2816
|
let params = [];
|
|
2815
2817
|
const paramsStatement = importStatement.find(n => n.name === "with-params-statement");
|
|
2816
2818
|
if (paramsStatement != null) {
|
|
2817
|
-
const statements = paramsStatement.find(n => n.name === "
|
|
2819
|
+
const statements = paramsStatement.find(n => n.name === "body");
|
|
2818
2820
|
if (statements != null) {
|
|
2819
2821
|
const expression = statements.toString();
|
|
2820
2822
|
const importedValues = Array.from(this
|