File size: 2,404 Bytes
31248b9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
import { DocNodeKind, DocNode } from './DocNode';
import { DocExcerpt, ExcerptKind } from './DocExcerpt';
/**
 * Represents a span of text that contained invalid markup.
 * The characters should be rendered as plain text.
 */
export class DocErrorText extends DocNode {
    /**
     * Don't call this directly.  Instead use {@link TSDocParser}
     * @internal
     */
    constructor(parameters) {
        super(parameters);
        this._textExcerpt = new DocExcerpt({
            configuration: this.configuration,
            excerptKind: ExcerptKind.ErrorText,
            content: parameters.textExcerpt
        });
        this._messageId = parameters.messageId;
        this._errorMessage = parameters.errorMessage;
        this._errorLocation = parameters.errorLocation;
    }
    /** @override */
    get kind() {
        return DocNodeKind.ErrorText;
    }
    /**
     * The characters that should be rendered as plain text because they
     * could not be parsed successfully.
     */
    get text() {
        if (this._text === undefined) {
            this._text = this._textExcerpt.content.toString();
        }
        return this._text;
    }
    get textExcerpt() {
        if (this._textExcerpt) {
            return this._textExcerpt.content;
        }
        else {
            return undefined;
        }
    }
    /**
     * The TSDoc error message identifier.
     */
    get messageId() {
        return this._messageId;
    }
    /**
     * A description of why the character could not be parsed.
     */
    get errorMessage() {
        return this._errorMessage;
    }
    /**
     * The range of characters that caused the error.  In general these may be
     * somewhat farther ahead in the input stream from the DocErrorText node itself.
     *
     * @remarks
     * For example, for the malformed HTML tag `<a href="123" @ /a>`, the DocErrorText node
     * will correspond to the `<` character that looked like an HTML tag, whereas the
     * error location might be the `@` character that caused the trouble.
     */
    get errorLocation() {
        return this._errorLocation;
    }
    /** @override */
    onGetChildNodes() {
        return [this._textExcerpt];
    }
}
//# sourceMappingURL=DocErrorText.js.map