clarity-pattern-parser 11.1.2 → 11.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clarity-pattern-parser",
3
- "version": "11.1.2",
3
+ "version": "11.1.4",
4
4
  "description": "Parsing Library for Typescript and Javascript.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.esm.js",
@@ -168,10 +168,10 @@ describe("Expression Pattern", () => {
168
168
  });
169
169
 
170
170
  test("Clone With New Name", ()=>{
171
- const expression = createTailExpression();
171
+ const expression = createExpressionPattern();
172
172
  const clone = expression.clone("new-expression");
173
173
 
174
- const result = clone.exec("a.b");
174
+ const result = clone.exec("a || b && c * d");
175
175
  expect(result).toBe(result);
176
176
  });
177
177
  });
@@ -552,7 +552,7 @@ export class Expression implements Pattern {
552
552
 
553
553
  clone(name = this._name): Pattern {
554
554
  const clone = new Expression(name, this._originalPatterns);
555
- clone._originalName = this.name;
555
+ clone._originalName = this._originalName;
556
556
  clone._id = this._id;
557
557
  return clone;
558
558
  }
@@ -17,7 +17,7 @@ export function generateErrorMessage(pattern: Pattern, cursor: Cursor) {
17
17
  }
18
18
 
19
19
  const lastPattern = furthestMatch.pattern as Pattern;
20
- const suggestions = cleanSuggestions(lastPattern.getTokens());
20
+ const suggestions = cleanSuggestions(lastPattern.getNextTokens());
21
21
  const strUpToError = cursor.getChars(0, endIndex);
22
22
  const lines = strUpToError.split("\n");
23
23
  const lastLine = lines[lines.length - 1];