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.browser.js
CHANGED
|
@@ -915,8 +915,8 @@
|
|
|
915
915
|
}
|
|
916
916
|
const children = clonePatterns(options);
|
|
917
917
|
this._assignChildrenToParent(children);
|
|
918
|
-
this._id = `
|
|
919
|
-
this._type = "
|
|
918
|
+
this._id = `options-${idIndex$6++}`;
|
|
919
|
+
this._type = "options";
|
|
920
920
|
this._name = name;
|
|
921
921
|
this._parent = null;
|
|
922
922
|
this._children = children;
|
|
@@ -2058,7 +2058,8 @@
|
|
|
2058
2058
|
|
|
2059
2059
|
const bodyLineContent = new Options("body-line-content", [
|
|
2060
2060
|
comment,
|
|
2061
|
-
statement
|
|
2061
|
+
statement,
|
|
2062
|
+
lineSpaces$1
|
|
2062
2063
|
]);
|
|
2063
2064
|
const optionalLineSpaces$2 = new Optional("optional-line-spaces", lineSpaces$1);
|
|
2064
2065
|
const bodyLine = new Sequence("body-line", [
|
|
@@ -2101,7 +2102,7 @@
|
|
|
2101
2102
|
optionalLineSpaces$1,
|
|
2102
2103
|
openBracket,
|
|
2103
2104
|
optionalSpaces$1,
|
|
2104
|
-
body
|
|
2105
|
+
body,
|
|
2105
2106
|
optionalSpaces$1,
|
|
2106
2107
|
closeBracket
|
|
2107
2108
|
]));
|
|
@@ -2554,11 +2555,12 @@
|
|
|
2554
2555
|
return importBlock && importBlock.children.length > 0;
|
|
2555
2556
|
}
|
|
2556
2557
|
_buildPatterns(ast) {
|
|
2557
|
-
const body = ast.find(n => n.name === "body");
|
|
2558
|
+
const body = ast.find(n => n.name === "body" && n.findAncester(n => n.name === "head") == null);
|
|
2558
2559
|
if (body == null) {
|
|
2559
2560
|
return;
|
|
2560
2561
|
}
|
|
2561
|
-
body.findAll(n => n.name === "assign-statement")
|
|
2562
|
+
const statements = body.findAll(n => n.name === "assign-statement");
|
|
2563
|
+
statements.forEach((n) => {
|
|
2562
2564
|
const patternNode = n.children.find(n => patternNodes[n.name] != null);
|
|
2563
2565
|
if (patternNode == null) {
|
|
2564
2566
|
return;
|
|
@@ -2820,7 +2822,7 @@
|
|
|
2820
2822
|
let params = [];
|
|
2821
2823
|
const paramsStatement = importStatement.find(n => n.name === "with-params-statement");
|
|
2822
2824
|
if (paramsStatement != null) {
|
|
2823
|
-
const statements = paramsStatement.find(n => n.name === "
|
|
2825
|
+
const statements = paramsStatement.find(n => n.name === "body");
|
|
2824
2826
|
if (statements != null) {
|
|
2825
2827
|
const expression = statements.toString();
|
|
2826
2828
|
const importedValues = Array.from(this
|