UNPKG

1.34 kBTypeScriptView Raw
1import { DocNode } from '../../nodes';
2import { TokenSequence } from '../TokenSequence';
3import { ParserContext } from '../ParserContext';
4/**
5 * The TokenCoverageChecker performs two diagnostics to detect parser bugs:
6 * 1. It checks for two DocNode objects whose excerpt contains overlapping tokens.
7 * By design, a single character from the input stream should be associated with
8 * at most one TokenSequence.
9 * 2. It checks for gaps, i.e. input tokens that were not associated with any DocNode
10 * (that is reachable from the final DocCommon node tree). In some cases this is
11 * okay. For example, if `@public` appears twice inside a comment, the second
12 * redundant instance is ignored. But in general we want to track the gaps in the
13 * unit test snapshots to ensure in general that every input character is associated
14 * with an excerpt for a DocNode.
15 */
16export declare class TokenCoverageChecker {
17 private readonly _parserContext;
18 private readonly _tokenAssociations;
19 constructor(parserContext: ParserContext);
20 getGaps(rootNode: DocNode): TokenSequence[];
21 reportGaps(rootNode: DocNode): void;
22 private _addNodeTree;
23 private _addSequence;
24 private _checkForGaps;
25 private _reportGap;
26 private _formatTokenAssociation;
27}
28//# sourceMappingURL=TokenCoverageChecker.d.ts.map
\No newline at end of file