clarity-pattern-parser 9.1.0 → 9.2.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.
@@ -21,6 +21,8 @@ export declare class Repeat implements Pattern {
21
21
  get parent(): Pattern | null;
22
22
  set parent(value: Pattern | null);
23
23
  get children(): Pattern[];
24
+ get min(): any;
25
+ get max(): any;
24
26
  constructor(name: string, pattern: Pattern, options?: RepeatOptions);
25
27
  parse(cursor: Cursor): Node | null;
26
28
  exec(text: string): ParseResult;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clarity-pattern-parser",
3
- "version": "9.1.0",
3
+ "version": "9.2.1",
4
4
  "description": "Parsing Library for Typescript and Javascript.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.esm.js",
@@ -19,4 +19,4 @@ const bodyLine = new Sequence("body-line", [
19
19
  optionalLineSpaces,
20
20
  ]);
21
21
 
22
- export const body = new Repeat("body", bodyLine, {divider: newLine, min: 0});
22
+ export const body = new Optional("optional-body", new Repeat("body", bodyLine, {divider: newLine}));
@@ -52,6 +52,14 @@ export class Repeat implements Pattern {
52
52
  return this._children;
53
53
  }
54
54
 
55
+ get min() {
56
+ return (this.children[0] as any).min;
57
+ }
58
+
59
+ get max() {
60
+ return (this.children[0] as any).max || Infinity;
61
+ }
62
+
55
63
  constructor(name: string, pattern: Pattern, options: RepeatOptions = {}) {
56
64
  this._id = `repeat-${idIndex++}`;
57
65
  this._pattern = pattern;