UNPKG

4.91 kBTypeScriptView Raw
1import { DocNode, IDocNodeParameters, DocNodeKind } from './DocNode';
2import { TokenSequence } from '../parser/TokenSequence';
3/**
4 * Indicates the type of {@link DocExcerpt}.
5 */
6export declare enum ExcerptKind {
7 Spacing = "Spacing",
8 BlockTag = "BlockTag",
9 CodeSpan_OpeningDelimiter = "CodeSpan_OpeningDelimiter",
10 CodeSpan_Code = "CodeSpan_Code",
11 CodeSpan_ClosingDelimiter = "CodeSpan_ClosingDelimiter",
12 DeclarationReference_PackageName = "DeclarationReference_PackageName",
13 DeclarationReference_ImportPath = "DeclarationReference_ImportPath",
14 DeclarationReference_ImportHash = "DeclarationReference_ImportHash",
15 /**
16 * Input characters that were reported as an error and do not appear to be part of a valid expression.
17 * A syntax highlighter might display them with an error color (e.g. red).
18 */
19 ErrorText = "ErrorText",
20 /**
21 * Input characters that do not conform to the TSDoc specification, but were recognized by the parser, for example
22 * as a known JSDoc pattern. A syntax highlighter should not display them with an error color (e.g. red)
23 * because the error reporting may be suppressed for "lax" parsing of legacy source code.
24 */
25 NonstandardText = "NonstandardText",
26 EscapedText = "EscapedText",
27 FencedCode_OpeningFence = "FencedCode_OpeningFence",
28 FencedCode_Language = "FencedCode_Language",
29 FencedCode_Code = "FencedCode_Code",
30 FencedCode_ClosingFence = "FencedCode_ClosingFence",
31 HtmlAttribute_Name = "HtmlAttribute_Name",
32 HtmlAttribute_Equals = "HtmlAttribute_Equals",
33 HtmlAttribute_Value = "HtmlAttribute_Value",
34 HtmlEndTag_OpeningDelimiter = "HtmlEndTag_OpeningDelimiter",
35 HtmlEndTag_Name = "HtmlEndTag_Name",
36 HtmlEndTag_ClosingDelimiter = "HtmlEndTag_ClosingDelimiter",
37 HtmlStartTag_OpeningDelimiter = "HtmlStartTag_OpeningDelimiter",
38 HtmlStartTag_Name = "HtmlStartTag_Name",
39 HtmlStartTag_ClosingDelimiter = "HtmlStartTag_ClosingDelimiter",
40 InlineTag_OpeningDelimiter = "InlineTag_OpeningDelimiter",
41 InlineTag_TagName = "InlineTag_TagName",
42 InlineTag_TagContent = "InlineTag_TagContent",
43 InlineTag_ClosingDelimiter = "InlineTag_ClosingDelimiter",
44 LinkTag_UrlDestination = "LinkTag_UrlDestination",
45 LinkTag_Pipe = "LinkTag_Pipe",
46 LinkTag_LinkText = "LinkTag_LinkText",
47 MemberIdentifier_LeftQuote = "MemberIdentifier_LeftQuote",
48 MemberIdentifier_Identifier = "MemberIdentifier_Identifier",
49 MemberIdentifier_RightQuote = "MemberIdentifier_RightQuote",
50 MemberReference_Dot = "MemberReference_Dot",
51 MemberReference_LeftParenthesis = "MemberReference_LeftParenthesis",
52 MemberReference_Colon = "MemberReference_Colon",
53 MemberReference_RightParenthesis = "MemberReference_RightParenthesis",
54 MemberSelector = "MemberSelector",
55 DocMemberSymbol_LeftBracket = "DocMemberSymbol_LeftBracket",
56 DocMemberSymbol_RightBracket = "DocMemberSymbol_RightBracket",
57 ParamBlock_ParameterName = "ParamBlock_ParameterName",
58 ParamBlock_Hyphen = "ParamBlock_Hyphen",
59 PlainText = "PlainText",
60 SoftBreak = "SoftBreak"
61}
62/**
63 * Constructor parameters for {@link DocExcerpt}.
64 */
65export interface IDocExcerptParameters extends IDocNodeParameters {
66 excerptKind: ExcerptKind;
67 content: TokenSequence;
68}
69/**
70 * Represents a parsed token sequence.
71 *
72 * @remarks
73 * When a `DocNode` is created by parsing a doc comment, it will have `DocExcerpt` child nodes corresponding to
74 * the parsed syntax elements such as names, keywords, punctuation, and spaces. These excerpts indicate the original
75 * coordinates of the syntax element, and thus can be used for syntax highlighting and precise error reporting.
76 * They could also be used to rewrite specific words in a source file (e.g. renaming a parameter) without disturbing
77 * any other characters in the file.
78 *
79 * Every parsed character will correspond to at most one DocExcerpt object. In other words, excerpts never overlap.
80 * A given excerpt can span multiple comment lines, and it may contain gaps, for example to skip the `*` character
81 * that starts a new TSDoc comment line.
82 */
83export declare class DocExcerpt extends DocNode {
84 private readonly _excerptKind;
85 private readonly _content;
86 /**
87 * Don't call this directly. Instead use {@link TSDocParser}
88 * @internal
89 */
90 constructor(parameters: IDocExcerptParameters);
91 /** @override */
92 get kind(): DocNodeKind | string;
93 /**
94 * Indicates the kind of DocExcerpt.
95 */
96 get excerptKind(): ExcerptKind;
97 /**
98 * The input token sequence corresponding to this excerpt.
99 * @remarks
100 * Note that a token sequence can span multiple input lines and may contain gaps, for example to skip the `*`
101 * character that starts a new TSDoc comment line.
102 */
103 get content(): TokenSequence;
104}
105//# sourceMappingURL=DocExcerpt.d.ts.map
\No newline at end of file