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.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;
|
|
@@ -2056,7 +2056,8 @@ const statement = new Options("statement", [assignStatement, name$1.clone("expor
|
|
|
2056
2056
|
|
|
2057
2057
|
const bodyLineContent = new Options("body-line-content", [
|
|
2058
2058
|
comment,
|
|
2059
|
-
statement
|
|
2059
|
+
statement,
|
|
2060
|
+
lineSpaces$1
|
|
2060
2061
|
]);
|
|
2061
2062
|
const optionalLineSpaces$2 = new Optional("optional-line-spaces", lineSpaces$1);
|
|
2062
2063
|
const bodyLine = new Sequence("body-line", [
|
|
@@ -2099,7 +2100,7 @@ const withParamsStatement = new Optional("optional-with-params-statement", new S
|
|
|
2099
2100
|
optionalLineSpaces$1,
|
|
2100
2101
|
openBracket,
|
|
2101
2102
|
optionalSpaces$1,
|
|
2102
|
-
body
|
|
2103
|
+
body,
|
|
2103
2104
|
optionalSpaces$1,
|
|
2104
2105
|
closeBracket
|
|
2105
2106
|
]));
|
|
@@ -2552,11 +2553,12 @@ class Grammar {
|
|
|
2552
2553
|
return importBlock && importBlock.children.length > 0;
|
|
2553
2554
|
}
|
|
2554
2555
|
_buildPatterns(ast) {
|
|
2555
|
-
const body = ast.find(n => n.name === "body");
|
|
2556
|
+
const body = ast.find(n => n.name === "body" && n.findAncester(n => n.name === "head") == null);
|
|
2556
2557
|
if (body == null) {
|
|
2557
2558
|
return;
|
|
2558
2559
|
}
|
|
2559
|
-
body.findAll(n => n.name === "assign-statement")
|
|
2560
|
+
const statements = body.findAll(n => n.name === "assign-statement");
|
|
2561
|
+
statements.forEach((n) => {
|
|
2560
2562
|
const patternNode = n.children.find(n => patternNodes[n.name] != null);
|
|
2561
2563
|
if (patternNode == null) {
|
|
2562
2564
|
return;
|
|
@@ -2818,7 +2820,7 @@ class Grammar {
|
|
|
2818
2820
|
let params = [];
|
|
2819
2821
|
const paramsStatement = importStatement.find(n => n.name === "with-params-statement");
|
|
2820
2822
|
if (paramsStatement != null) {
|
|
2821
|
-
const statements = paramsStatement.find(n => n.name === "
|
|
2823
|
+
const statements = paramsStatement.find(n => n.name === "body");
|
|
2822
2824
|
if (statements != null) {
|
|
2823
2825
|
const expression = statements.toString();
|
|
2824
2826
|
const importedValues = Array.from(this
|