clarity-pattern-parser 9.2.3 → 9.2.5

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": "9.2.3",
3
+ "version": "9.2.5",
4
4
  "description": "Parsing Library for Typescript and Javascript.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.esm.js",
@@ -307,16 +307,12 @@ describe("Node", () => {
307
307
  type: "parent",
308
308
  name: "parent",
309
309
  value: "AB",
310
- firstIndex: 0,
311
- lastIndex: 0,
312
310
  startIndex: 0,
313
311
  endIndex: 1,
314
312
  children: [{
315
313
  type: "a",
316
314
  name: "a",
317
315
  value: "A",
318
- firstIndex: 0,
319
- lastIndex: 0,
320
316
  startIndex: 0,
321
317
  endIndex: 1,
322
318
  children: [],
@@ -324,8 +320,6 @@ describe("Node", () => {
324
320
  type: "b",
325
321
  name: "b",
326
322
  value: "B",
327
- firstIndex: 0,
328
- lastIndex: 0,
329
323
  startIndex: 0,
330
324
  endIndex: 1,
331
325
  children: [],
package/src/ast/Node.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  export interface CycleFreeNode {
2
2
  type: string;
3
3
  name: string;
4
- firstIndex: number;
5
- lastIndex: number;
6
4
  startIndex: number;
7
5
  endIndex: number;
8
6
  value: string;
@@ -269,12 +267,10 @@ export class Node {
269
267
  type: this._type,
270
268
  name: this._name,
271
269
  value: this.toString(),
272
- firstIndex: this._firstIndex,
273
- lastIndex: this._lastIndex,
274
270
  startIndex: this.startIndex,
275
271
  endIndex: this.endIndex,
276
272
  children: this._children.map(c => c.toCycleFreeObject()),
277
- }
273
+ };
278
274
  }
279
275
 
280
276
  toJson(space?: number): string {
@@ -499,4 +499,15 @@ describe("Grammar", () => {
499
499
 
500
500
  expect(arePatternsEqual(patterns["complex-expression"], expected)).toBeTruthy();
501
501
  });
502
+
503
+ test("Grammar With Spaces", ()=>{
504
+ const expression = `
505
+ john = "John"
506
+
507
+ jane = "Jane"
508
+ `;
509
+ const patterns = Grammar.parseString(expression);
510
+ expect(patterns.john).not.toBeNull();
511
+ expect(patterns.jane).not.toBeNull();
512
+ });
502
513
  });
@@ -8,15 +8,14 @@ import { Optional } from "../../patterns/Optional";
8
8
 
9
9
  const bodyLineContent = new Options("body-line-content", [
10
10
  comment,
11
- statement,
12
- lineSpaces
11
+ statement
13
12
  ]);
14
13
 
15
14
  const optionalLineSpaces = new Optional("optional-line-spaces", lineSpaces);
16
15
 
17
16
  const bodyLine = new Sequence("body-line", [
18
17
  optionalLineSpaces,
19
- bodyLineContent,
18
+ new Optional("optional-body-line-content", bodyLineContent),
20
19
  optionalLineSpaces,
21
20
  ]);
22
21
 
@@ -28,7 +28,7 @@ describe("Patterns String Template Literal", ()=>{
28
28
  debugger;
29
29
  const result = body.exec(`
30
30
  <div>
31
- <span></span>
31
+ <div></div>
32
32
  <div></div>
33
33
  </div>
34
34
  `, true);