clarity-pattern-parser 11.3.0 → 11.3.1

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.3.0",
3
+ "version": "11.3.1",
4
4
  "description": "Parsing Library for Typescript and Javascript.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.esm.js",
@@ -5,14 +5,17 @@ import { TypescriptVisitor } from "./typescriptVisitor";
5
5
  describe("generator", () => {
6
6
  test("Every Pattern", () => {
7
7
  const { expression } = patterns`
8
- names = "John" | "Jane"
8
+ john = "John"
9
+ names = john | "Jane"
9
10
  space = /\\s+/
10
11
  comma = /\\s*,\\s*/
11
12
  item = names | array
12
13
  items = (item, comma)+
13
14
  array = "[" + space? + items? + space? + "]"
14
- and-expression = expression + " and " + expression
15
- expression = and-expression | item
15
+ prefix-expression = "pre" + expression
16
+ postfix-expression = expression + "post"
17
+ infix-expression = expression + " and " + expression
18
+ expression = prefix-expression | postfix-expression | infix-expression | item
16
19
  `;
17
20
 
18
21
  const visitor = new TypescriptVisitor();
@@ -2,7 +2,6 @@ import { Literal } from "../../patterns/Literal"
2
2
  import { Optional } from "../../patterns/Optional";
3
3
  import { Sequence } from "../../patterns/Sequence";
4
4
  import { lineSpaces } from "./spaces";
5
- import { name } from "./name";
6
5
  import { Reference } from "../../patterns/Reference";
7
6
 
8
7
  const anyChar = new Literal("any-char", "?");
@@ -108,7 +108,7 @@ export class Reference implements Pattern {
108
108
  if (pattern.startedOnIndex === this.startedOnIndex) {
109
109
  depth++;
110
110
 
111
- if (depth > 0) {
111
+ if (depth > 1) {
112
112
  return true;
113
113
  }
114
114
  }