clarity-pattern-parser 11.3.11 → 11.3.13

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.
Files changed (93) hide show
  1. package/dist/ast/Node.test.d.ts +1 -0
  2. package/dist/grammar/Grammar.test.d.ts +1 -0
  3. package/dist/grammar/patterns.test.d.ts +1 -0
  4. package/dist/index.browser.js +5 -5
  5. package/dist/index.browser.js.map +1 -1
  6. package/dist/index.esm.js +5 -5
  7. package/dist/index.esm.js.map +1 -1
  8. package/dist/index.js +5 -5
  9. package/dist/index.js.map +1 -1
  10. package/dist/intellisense/AutoComplete.test.d.ts +2 -0
  11. package/dist/intellisense/css/cssValue.d.ts +3 -0
  12. package/dist/intellisense/css/divider.d.ts +3 -0
  13. package/dist/intellisense/css/hex.d.ts +3 -0
  14. package/dist/intellisense/css/method.d.ts +3 -0
  15. package/dist/intellisense/css/name.d.ts +3 -0
  16. package/dist/intellisense/css/number.d.ts +3 -0
  17. package/dist/intellisense/css/optionalSpaces.d.ts +2 -0
  18. package/dist/intellisense/css/spaces.d.ts +3 -0
  19. package/dist/intellisense/css/unit.d.ts +3 -0
  20. package/dist/intellisense/css/value.d.ts +3 -0
  21. package/dist/intellisense/css/values.d.ts +3 -0
  22. package/dist/intellisense/javascript/Javascript.test.d.ts +1 -0
  23. package/dist/intellisense/javascript/arrayLiteral.d.ts +2 -0
  24. package/dist/intellisense/javascript/assignment.d.ts +3 -0
  25. package/dist/intellisense/javascript/deleteStatement.d.ts +2 -0
  26. package/dist/intellisense/javascript/escapedCharacter.d.ts +3 -0
  27. package/dist/intellisense/javascript/exponent.d.ts +3 -0
  28. package/dist/intellisense/javascript/expression.d.ts +3 -0
  29. package/dist/intellisense/javascript/fraction.d.ts +3 -0
  30. package/dist/intellisense/javascript/infixOperator.d.ts +3 -0
  31. package/dist/intellisense/javascript/integer.d.ts +3 -0
  32. package/dist/intellisense/javascript/invocation.d.ts +2 -0
  33. package/dist/intellisense/javascript/keywords.d.ts +2 -0
  34. package/dist/intellisense/javascript/literal.d.ts +3 -0
  35. package/dist/intellisense/javascript/name.d.ts +2 -0
  36. package/dist/intellisense/javascript/numberLiteral.d.ts +2 -0
  37. package/dist/intellisense/javascript/objectAccess.d.ts +2 -0
  38. package/dist/intellisense/javascript/objectLiteral.d.ts +3 -0
  39. package/dist/intellisense/javascript/optionalSpaces.d.ts +2 -0
  40. package/dist/intellisense/javascript/parameters.d.ts +3 -0
  41. package/dist/intellisense/javascript/prefixOperator.d.ts +3 -0
  42. package/dist/intellisense/javascript/propertyAccess.d.ts +3 -0
  43. package/dist/intellisense/javascript/stringLiteral.d.ts +3 -0
  44. package/dist/patterns/Context.test.d.ts +1 -0
  45. package/dist/patterns/Cursor.test.d.ts +1 -0
  46. package/dist/patterns/CursorHistory.test.d.ts +1 -0
  47. package/dist/patterns/Expression.test.d.ts +1 -0
  48. package/dist/patterns/FiniteRepeat.test.d.ts +1 -0
  49. package/dist/patterns/InfiniteRepeat.test.d.ts +1 -0
  50. package/dist/patterns/Literal.test.d.ts +1 -0
  51. package/dist/patterns/Not.test.d.ts +1 -0
  52. package/dist/patterns/Optional.test.d.ts +1 -0
  53. package/dist/patterns/Options.test.d.ts +1 -0
  54. package/dist/patterns/PrecedenceTree.test.d.ts +1 -0
  55. package/dist/patterns/Reference.test.d.ts +1 -0
  56. package/dist/patterns/Regex.test.d.ts +1 -0
  57. package/dist/patterns/Repeat.d.ts +2 -2
  58. package/dist/patterns/Repeat.test.d.ts +1 -0
  59. package/dist/patterns/Sequence.test.d.ts +1 -0
  60. package/dist/patterns/TakeUntil.test.d.ts +1 -0
  61. package/dist/query/query.test.d.ts +1 -0
  62. package/dist/query/selector.test.d.ts +1 -0
  63. package/jest.config.js +1 -1
  64. package/package.json +1 -1
  65. package/src/intellisense/AutoComplete.test.ts +21 -2
  66. package/src/intellisense/AutoComplete.ts +1 -1
  67. package/src/intellisense/css/optionalSpaces.ts +1 -1
  68. package/src/intellisense/css/value.ts +1 -1
  69. package/src/patterns/Repeat.ts +4 -4
  70. package/tsconfig.json +1 -1
  71. package/dist/Cursor.d.ts +0 -37
  72. package/dist/CursorHistory.d.ts +0 -27
  73. package/dist/TextSuggester.d.ts +0 -48
  74. package/dist/ast/Visitor.d.ts +0 -31
  75. package/dist/grammar/patterns/andLiteral.d.ts +0 -4
  76. package/dist/grammar/patterns/inlinePattern.d.ts +0 -1
  77. package/dist/grammar/patterns/orLiteral.d.ts +0 -2
  78. package/dist/patterns/And.d.ts +0 -41
  79. package/dist/patterns/DepthCache.d.ts +0 -6
  80. package/dist/patterns/ExpressionPattern.d.ts +0 -66
  81. package/dist/patterns/LookAhead.d.ts +0 -8
  82. package/dist/patterns/Or.d.ts +0 -36
  83. package/dist/patterns/Recursive.d.ts +0 -12
  84. package/dist/patterns/RightAssociatedPattern.d.ts +0 -31
  85. package/dist/patterns/arePatternsEqual.d.ts +0 -2
  86. package/dist/patterns/getNextPattern.d.ts +0 -2
  87. package/dist/types.d.ts +0 -797
  88. package/src/generator/delete.ts +0 -88
  89. package/src/generator/generator.test.ts +0 -28
  90. package/src/generator/generator.ts +0 -106
  91. package/src/generator/igenerator.ts +0 -6
  92. package/src/generator/ivisitor.ts +0 -24
  93. package/src/generator/typescriptVisitor.ts +0 -179
@@ -0,0 +1,2 @@
1
+ import { Repeat } from "../patterns/Repeat";
2
+ export declare function generateExpression(flagNames: string[]): Repeat;
@@ -0,0 +1,3 @@
1
+ import { Repeat } from "../../patterns/Repeat";
2
+ declare const cssValue: Repeat;
3
+ export default cssValue;
@@ -0,0 +1,3 @@
1
+ import { Regex } from "../../patterns/Regex";
2
+ declare const divider: Regex;
3
+ export default divider;
@@ -0,0 +1,3 @@
1
+ import { Regex } from "../../patterns/Regex";
2
+ declare const hex: Regex;
3
+ export default hex;
@@ -0,0 +1,3 @@
1
+ import { Sequence } from "../../patterns/Sequence";
2
+ declare const method: Sequence;
3
+ export default method;
@@ -0,0 +1,3 @@
1
+ import { Regex } from "../../patterns/Regex";
2
+ declare const name: Regex;
3
+ export default name;
@@ -0,0 +1,3 @@
1
+ import { Regex } from "../../patterns/Regex";
2
+ declare const number: Regex;
3
+ export default number;
@@ -0,0 +1,2 @@
1
+ declare const optionalSpaces: import("../..").Regex;
2
+ export default optionalSpaces;
@@ -0,0 +1,3 @@
1
+ import { Regex } from "../../patterns/Regex";
2
+ declare const spaces: Regex;
3
+ export default spaces;
@@ -0,0 +1,3 @@
1
+ import { Sequence } from "../../patterns/Sequence";
2
+ declare const unit: Sequence;
3
+ export default unit;
@@ -0,0 +1,3 @@
1
+ import { Options } from "../../patterns/Options";
2
+ declare const value: Options;
3
+ export default value;
@@ -0,0 +1,3 @@
1
+ import { Repeat } from "../../patterns/Repeat";
2
+ declare const values: Repeat;
3
+ export default values;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { Options } from "../../patterns/Options";
2
+ export declare const arrayLiteral: Options;
@@ -0,0 +1,3 @@
1
+ import { Sequence } from "../../patterns/Sequence";
2
+ declare const assignment: Sequence;
3
+ export { assignment };
@@ -0,0 +1,2 @@
1
+ import { Sequence } from "../../patterns/Sequence";
2
+ export declare const deleteStatement: Sequence;
@@ -0,0 +1,3 @@
1
+ import { Sequence } from "../../patterns/Sequence";
2
+ declare const escapedCharacter: Sequence;
3
+ export { escapedCharacter };
@@ -0,0 +1,3 @@
1
+ import { Sequence } from "../../patterns/Sequence";
2
+ declare const exponent: Sequence;
3
+ export { exponent };
@@ -0,0 +1,3 @@
1
+ import { Options } from "../../patterns/Options";
2
+ declare const expression: Options;
3
+ export { expression };
@@ -0,0 +1,3 @@
1
+ import { Sequence } from "../../patterns/Sequence";
2
+ declare const fraction: Sequence;
3
+ export { fraction };
@@ -0,0 +1,3 @@
1
+ import { Options } from "../../patterns/Options";
2
+ declare const infixOperator: Options;
3
+ export { infixOperator };
@@ -0,0 +1,3 @@
1
+ import { Regex } from "../../patterns/Regex";
2
+ declare const integer: Regex;
3
+ export { integer };
@@ -0,0 +1,2 @@
1
+ import { Options } from "../../patterns/Options";
2
+ export declare const invocation: Options;
@@ -0,0 +1,2 @@
1
+ import { Literal } from "../../patterns/Literal";
2
+ export declare const nullKeyword: Literal;
@@ -0,0 +1,3 @@
1
+ import { Options } from "../../patterns/Options";
2
+ declare const literal: Options;
3
+ export { literal };
@@ -0,0 +1,2 @@
1
+ import { Regex } from "../../patterns/Regex";
2
+ export declare const name: Regex;
@@ -0,0 +1,2 @@
1
+ import { Sequence } from "../../patterns/Sequence";
2
+ export declare const numberLiteral: Sequence;
@@ -0,0 +1,2 @@
1
+ import { Sequence } from "../../patterns/Sequence";
2
+ export declare const objectAccess: Sequence;
@@ -0,0 +1,3 @@
1
+ import { Sequence } from "../../patterns/Sequence";
2
+ declare const objectLiteral: Sequence;
3
+ export { objectLiteral };
@@ -0,0 +1,2 @@
1
+ import { Optional } from "../../patterns/Optional";
2
+ export declare const optionalSpaces: Optional;
@@ -0,0 +1,3 @@
1
+ import { Sequence } from "../../patterns/Sequence";
2
+ declare const parameters: Sequence;
3
+ export { parameters };
@@ -0,0 +1,3 @@
1
+ import { Options } from "../../patterns/Options";
2
+ declare const prefixOperator: Options;
3
+ export { prefixOperator };
@@ -0,0 +1,3 @@
1
+ import { Sequence } from "../../patterns/Sequence";
2
+ declare const propertyAccess: Sequence;
3
+ export { propertyAccess };
@@ -0,0 +1,3 @@
1
+ import { Options } from "../../patterns/Options";
2
+ declare const stringLiteral: Options;
3
+ export { stringLiteral };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -33,8 +33,8 @@ export declare class Repeat implements Pattern {
33
33
  get options(): InternalRepeatOptions;
34
34
  constructor(name: string, pattern: Pattern, options?: RepeatOptions);
35
35
  parse(cursor: Cursor): Node | null;
36
- exec(text: string): ParseResult;
37
- test(text: string): boolean;
36
+ exec(text: string, record?: boolean): ParseResult;
37
+ test(text: string, record?: boolean): boolean;
38
38
  clone(name?: string): Repeat;
39
39
  getTokens(): string[];
40
40
  getTokensAfter(_childReference: Pattern): string[];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/jest.config.js CHANGED
@@ -9,6 +9,6 @@ module.exports = {
9
9
  "**/?(*.)+(spec|test).+(ts|tsx|js)"
10
10
  ],
11
11
  "transform": {
12
- "^.+\\.(ts|tsx)$": "ts-jest"
12
+ "^.+\\.(ts|tsx)$": "ts-jest",
13
13
  },
14
14
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clarity-pattern-parser",
3
- "version": "11.3.11",
3
+ "version": "11.3.13",
4
4
  "description": "Parsing Library for Typescript and Javascript.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.esm.js",
@@ -1260,6 +1260,25 @@ describe("AutoComplete", () => {
1260
1260
 
1261
1261
 
1262
1262
 
1263
- });
1264
1263
 
1265
-
1264
+ test('options return farthest match when encountering options with shared initial literals', () => {
1265
+ const startBracket = new Literal('shared-starting-literal', '{');
1266
+
1267
+ const abcLiteral = new Literal('abc', 'abc');
1268
+ const xyzLiteral = new Literal('xyz', 'xyz');
1269
+
1270
+ const sequenceOne = new Sequence('sequence-one', [startBracket, abcLiteral]);
1271
+ const sequenceTwo = new Sequence('sequence-two', [startBracket, xyzLiteral]);
1272
+
1273
+ // create options with sequences that have matching initial literals
1274
+ const options = new Options('options', [sequenceOne, sequenceTwo]);
1275
+
1276
+ const autoComplete = new AutoComplete(options);
1277
+ const results = autoComplete.suggestFor('{a');
1278
+
1279
+ const expectedOptions: ExpectedOption[] = [
1280
+ { text: 'bc', startIndex: 2, subElements: [{ text: 'abc', pattern: abcLiteral.name }] },
1281
+ ];
1282
+ optionsMatchExpected(results.options, expectedOptions);
1283
+ });
1284
+ });
@@ -140,7 +140,7 @@ export class AutoComplete {
140
140
  }
141
141
  });
142
142
 
143
- return finalResults;
143
+ return getFurthestOptions(finalResults);
144
144
  }
145
145
 
146
146
  private _createSuggestionOptionsFromErrors() {
@@ -1,5 +1,5 @@
1
1
  import spaces from "./spaces";
2
2
 
3
- const optionalSpaces = spaces.clone(spaces.name, true);
3
+ const optionalSpaces = spaces.clone(spaces.name);
4
4
 
5
5
  export default optionalSpaces;
@@ -5,6 +5,6 @@ import method from "./method";
5
5
  import name from "./name"
6
6
  import { Options } from "../../patterns/Options";
7
7
 
8
- const value = new Or("value", [hex, method, unit, number, name]);
8
+ const value = new Options("value", [hex, method, unit, number, name]);
9
9
 
10
10
  export default value;
@@ -96,12 +96,12 @@ export class Repeat implements Pattern {
96
96
  return this._repeatPattern.parse(cursor);
97
97
  }
98
98
 
99
- exec(text: string): ParseResult {
100
- return this._repeatPattern.exec(text);
99
+ exec(text: string, record = false): ParseResult {
100
+ return this._repeatPattern.exec(text, record);
101
101
  }
102
102
 
103
- test(text: string): boolean {
104
- return this._repeatPattern.test(text);
103
+ test(text: string, record = false): boolean {
104
+ return this._repeatPattern.test(text, record);
105
105
  }
106
106
 
107
107
  clone(name = this.name) {
package/tsconfig.json CHANGED
@@ -17,5 +17,5 @@
17
17
  "strictNullChecks": true
18
18
  },
19
19
  "exclude": ["node_modules"],
20
- "files": ["./src/index.ts"]
20
+ "include": ["src"]
21
21
  }
package/dist/Cursor.d.ts DELETED
@@ -1,37 +0,0 @@
1
- import Pattern from "./patterns/Pattern";
2
- import Node from "./ast/Node";
3
- import CursorHistory from "./CursorHistory";
4
- import ParseError from "./patterns/ParseError";
5
- export default class Cursor {
6
- text: string;
7
- index: number;
8
- length: number;
9
- history: CursorHistory;
10
- isInErrorState: boolean;
11
- constructor(text: string);
12
- assertValidity(): void;
13
- startRecording(): void;
14
- stopRecording(): void;
15
- get parseError(): ParseError | null;
16
- get lastMatch(): import("./CursorHistory").Match;
17
- throwError(parseError: ParseError): void;
18
- addMatch(pattern: Pattern, astNode: Node): void;
19
- resolveError(): void;
20
- hasUnresolvedError(): boolean;
21
- isNullOrEmpty(value: string | null): boolean;
22
- hasNext(): boolean;
23
- hasPrevious(): boolean;
24
- next(): void;
25
- previous(): void;
26
- mark(): number;
27
- moveToMark(mark: number): void;
28
- moveToBeginning(): void;
29
- moveToEnd(): void;
30
- getChar(): string;
31
- getIndex(): number;
32
- setIndex(index: number): void;
33
- isAtBeginning(): boolean;
34
- isAtEnd(): boolean;
35
- lastIndex(): number;
36
- didSuccessfullyParse(): boolean;
37
- }
@@ -1,27 +0,0 @@
1
- import Pattern from "./patterns/Pattern";
2
- import Node from "./ast/Node";
3
- import ParseError from "./patterns/ParseError";
4
- export interface Match {
5
- pattern: Pattern | null;
6
- astNode: Node | null;
7
- }
8
- export default class CursorHistory {
9
- isRecording: boolean;
10
- furthestMatch: Match;
11
- furthestError: ParseError | null;
12
- patterns: Pattern[];
13
- astNodes: Node[];
14
- errors: ParseError[];
15
- constructor();
16
- addMatch(pattern: Pattern, astNode: Node): void;
17
- addError(error: ParseError): void;
18
- startRecording(): void;
19
- stopRecording(): void;
20
- clear(): void;
21
- getFurthestError(): ParseError | null;
22
- getFurthestMatch(): Match;
23
- getLastMatch(): Match;
24
- getLastError(): ParseError;
25
- getAllParseStacks(): Node[][];
26
- getLastParseStack(): Node[];
27
- }
@@ -1,48 +0,0 @@
1
- import Node from "./ast/Node";
2
- import Pattern from "./patterns/Pattern";
3
- export interface Token {
4
- startIndex: number;
5
- values: string[];
6
- }
7
- export interface SuggestionError {
8
- startIndex: number;
9
- endIndex: number;
10
- text: string;
11
- }
12
- export interface SuggestionMatch {
13
- startIndex: number;
14
- endIndex: number;
15
- text: string;
16
- }
17
- export interface SuggestionResult {
18
- pattern: Pattern | null;
19
- astNode: Node | null;
20
- match: SuggestionMatch | null;
21
- error: SuggestionError | null;
22
- options: Token;
23
- isComplete: boolean;
24
- parseStack: Node[];
25
- }
26
- export default class TextSuggester {
27
- private cursor;
28
- private result;
29
- private text;
30
- private match;
31
- private error;
32
- private patternMatch;
33
- private matchedText;
34
- private rootPattern;
35
- private tokens;
36
- private options;
37
- private parseStack;
38
- suggest(text: string, pattern: Pattern): SuggestionResult;
39
- private reset;
40
- private parse;
41
- private saveParseStack;
42
- private saveMatchedText;
43
- private saveMatch;
44
- private saveError;
45
- private saveNextToken;
46
- private saveOptions;
47
- static suggest(text: string, pattern: Pattern): SuggestionResult;
48
- }
@@ -1,31 +0,0 @@
1
- import { Node } from "./Node";
2
- export declare class Visitor {
3
- root: Node | null;
4
- selectedNodes: Node[];
5
- constructor(root?: Node | null, selectedNodes?: Node[]);
6
- flatten(): this;
7
- remove(): this;
8
- private recursiveRemove;
9
- wrap(callback: (node: Node) => Node): this;
10
- unwrap(): this;
11
- prepend(callback: (node: Node) => Node): this;
12
- append(callback: (node: Node) => Node): this;
13
- transform(callback: (node: Node) => Node): this;
14
- private recursiveTransform;
15
- selectAll(): Visitor;
16
- selectNode(node: Node): Visitor;
17
- deselectNode(node: Node): Visitor;
18
- select(callback: (node: Node) => boolean): Visitor;
19
- forEach(callback: (node: Node) => void): this;
20
- filter(callback: (node: Node) => boolean): Visitor;
21
- map(callback: (node: Node) => Node): Visitor;
22
- selectRoot(): Visitor;
23
- first(): Visitor;
24
- last(): Visitor;
25
- get(index: number): Visitor;
26
- clear(): this;
27
- setRoot(root: Node | null): this;
28
- static select(root: Node, callback?: (node: Node) => boolean): Visitor;
29
- static walkUp(node: Node, callback: (node: Node, ancestors: Node[]) => void, ancestors?: Node[]): typeof Visitor;
30
- static walkDown(node: Node, callback: (node: Node, ancestors: Node[]) => void, ancestors?: Node[]): typeof Visitor;
31
- }
@@ -1,4 +0,0 @@
1
- import { Repeat } from "../../patterns/Repeat";
2
- import { And } from "../../patterns/And";
3
- export declare const pattern: And;
4
- export declare const andLiteral: Repeat;
@@ -1 +0,0 @@
1
- export declare const inlinePattern: any;
@@ -1,2 +0,0 @@
1
- import { Repeat } from "../../patterns/Repeat";
2
- export declare const orLiteral: Repeat;
@@ -1,41 +0,0 @@
1
- import { Cursor } from "./Cursor";
2
- import { Pattern } from "./Pattern";
3
- import { Node } from "../ast/Node";
4
- export declare class And implements Pattern {
5
- private _id;
6
- private _type;
7
- private _name;
8
- private _parent;
9
- private _children;
10
- private _isOptional;
11
- private _nodes;
12
- private _firstIndex;
13
- get id(): string;
14
- get type(): string;
15
- get name(): string;
16
- get parent(): Pattern | null;
17
- set parent(pattern: Pattern | null);
18
- get children(): Pattern[];
19
- get isOptional(): boolean;
20
- constructor(name: string, sequence: Pattern[], isOptional?: boolean);
21
- private _assignChildrenToParent;
22
- test(text: string): boolean;
23
- exec(text: string, record?: boolean): {
24
- ast: Node | null;
25
- cursor: Cursor;
26
- };
27
- parse(cursor: Cursor): Node | null;
28
- private tryToParse;
29
- private getLastValidNode;
30
- private areRemainingPatternsOptional;
31
- private createNode;
32
- getTokens(): string[];
33
- getTokensAfter(childReference: Pattern): string[];
34
- getNextTokens(): string[];
35
- getPatterns(): Pattern[];
36
- getPatternsAfter(childReference: Pattern): Pattern[];
37
- getNextPatterns(): Pattern[];
38
- find(predicate: (p: Pattern) => boolean): Pattern | null;
39
- clone(name?: string, isOptional?: boolean): Pattern;
40
- isEqual(pattern: And): boolean;
41
- }
@@ -1,6 +0,0 @@
1
- export declare class DepthCache {
2
- private _depthMap;
3
- getDepth(name: string, cursorIndex: number): number;
4
- incrementDepth(name: string, cursorIndex: number): void;
5
- decrementDepth(name: string, cursorIndex: number): void;
6
- }
@@ -1,66 +0,0 @@
1
- import { Node } from "../ast/Node";
2
- import { Cursor } from "./Cursor";
3
- import { ParseResult } from "./ParseResult";
4
- import { Pattern } from "./Pattern";
5
- export declare class ExpressionPattern implements Pattern {
6
- private _id;
7
- private _type;
8
- private _name;
9
- private _parent;
10
- private _firstIndex;
11
- private _originalPatterns;
12
- private _patterns;
13
- private _atomPatterns;
14
- private _prefixPatterns;
15
- private _prefixNames;
16
- private _postfixPatterns;
17
- private _postfixNames;
18
- private _binaryPatterns;
19
- private _binaryNames;
20
- private _associationMap;
21
- private _precedenceMap;
22
- private _shouldStopParsing;
23
- private _precedenceTree;
24
- get id(): string;
25
- get type(): string;
26
- get name(): string;
27
- get parent(): Pattern | null;
28
- set parent(pattern: Pattern | null);
29
- get children(): Pattern[];
30
- get prefixPatterns(): readonly Pattern[];
31
- get atomPatterns(): readonly Pattern[];
32
- get postfixPatterns(): readonly Pattern[];
33
- get binaryPatterns(): readonly Pattern[];
34
- get startedOnIndex(): number;
35
- constructor(name: string, patterns: Pattern[]);
36
- private _organizePatterns;
37
- private _extractName;
38
- private _isPrefix;
39
- private _extractPrefix;
40
- private _isAtom;
41
- private _isPostfix;
42
- private _extractPostfix;
43
- private _isBinary;
44
- private _extractBinary;
45
- private _unwrapAssociationIfNecessary;
46
- private _referenceCount;
47
- private _isRecursiveReference;
48
- parse(cursor: Cursor): Node | null;
49
- private _tryToParse;
50
- private _tryToMatchPrefix;
51
- private _tryToMatchAtom;
52
- private _tryToMatchPostfix;
53
- private _tryToMatchBinary;
54
- private _isBeyondRecursiveAllowance;
55
- test(text: string, record?: boolean): boolean;
56
- exec(text: string, record?: boolean): ParseResult;
57
- getTokens(): string[];
58
- getTokensAfter(childReference: Pattern): string[];
59
- getNextTokens(): string[];
60
- getPatterns(): Pattern[];
61
- getPatternsAfter(childReference: Pattern): Pattern[];
62
- getNextPatterns(): Pattern[];
63
- find(predicate: (p: Pattern) => boolean): Pattern | null;
64
- clone(name?: string): Pattern;
65
- isEqual(pattern: ExpressionPattern): boolean;
66
- }
@@ -1,8 +0,0 @@
1
- import Cursor from "../Cursor";
2
- import Pattern from "./Pattern";
3
- export default class LookAhead extends Pattern {
4
- constructor(pattern: Pattern);
5
- parse(cursor: Cursor): null;
6
- clone(): LookAhead;
7
- getTokens(): never[];
8
- }