Initial commit

This commit is contained in:
yuding
2025-12-03 12:00:46 +08:00
commit 5763b764a3
5365 changed files with 1483113 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
import type { ParserContext } from './ParserContext';
/**
* The main API for parsing TSDoc comments.
*/
export declare class LineExtractor {
private static readonly _whitespaceCharacterRegExp;
/**
* This step parses an entire code comment from slash-star-star until star-slash,
* and extracts the content lines. The lines are stored in IDocCommentParameters.lines
* and the overall text range is assigned to IDocCommentParameters.range.
*/
static extract(parserContext: ParserContext): boolean;
}
//# sourceMappingURL=LineExtractor.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"LineExtractor.d.ts","sourceRoot":"","sources":["../../src/parser/LineExtractor.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAmBrD;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,0BAA0B,CAAkB;IAEpE;;;;OAIG;WACW,OAAO,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO;CA8I7D"}

View File

@@ -0,0 +1,152 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
import { TSDocMessageId } from './TSDocMessageId';
// Internal parser state
var State;
(function (State) {
// Initial state, looking for "/*"
State[State["BeginComment1"] = 0] = "BeginComment1";
// Looking for "*" or "* " after "/*"
State[State["BeginComment2"] = 1] = "BeginComment2";
// Like State.CollectingLine except immediately after the "/**"
State[State["CollectingFirstLine"] = 2] = "CollectingFirstLine";
// Collecting characters until we reach a newline
State[State["CollectingLine"] = 3] = "CollectingLine";
// After a newline, looking for the "*" that begins a new line, or the "*/" to end the comment
State[State["AdvancingLine"] = 4] = "AdvancingLine";
// Exiting the parser loop
State[State["Done"] = 5] = "Done";
})(State || (State = {}));
/**
* The main API for parsing TSDoc comments.
*/
export class LineExtractor {
/**
* This step parses an entire code comment from slash-star-star until star-slash,
* and extracts the content lines. The lines are stored in IDocCommentParameters.lines
* and the overall text range is assigned to IDocCommentParameters.range.
*/
static extract(parserContext) {
const range = parserContext.sourceRange;
const buffer = range.buffer;
let commentRangeStart = 0;
let commentRangeEnd = 0;
// These must be set before entering CollectingFirstLine, CollectingLine, or AdvancingLine
let collectingLineStart = 0;
let collectingLineEnd = 0;
let nextIndex = range.pos;
let state = State.BeginComment1;
const lines = [];
while (state !== State.Done) {
if (nextIndex >= range.end) {
// reached the end of the input
switch (state) {
case State.BeginComment1:
case State.BeginComment2:
parserContext.log.addMessageForTextRange(TSDocMessageId.CommentNotFound, 'Expecting a "/**" comment', range);
return false;
default:
parserContext.log.addMessageForTextRange(TSDocMessageId.CommentMissingClosingDelimiter, 'Unexpected end of input', range);
return false;
}
}
const current = buffer[nextIndex];
const currentIndex = nextIndex;
++nextIndex;
const next = nextIndex < range.end ? buffer[nextIndex] : '';
switch (state) {
case State.BeginComment1:
if (current === '/' && next === '*') {
commentRangeStart = currentIndex;
++nextIndex; // skip the star
state = State.BeginComment2;
}
else if (!LineExtractor._whitespaceCharacterRegExp.test(current)) {
parserContext.log.addMessageForTextRange(TSDocMessageId.CommentOpeningDelimiterSyntax, 'Expecting a leading "/**"', range.getNewRange(currentIndex, currentIndex + 1));
return false;
}
break;
case State.BeginComment2:
if (current === '*') {
if (next === ' ') {
++nextIndex; // Discard the space after the star
}
collectingLineStart = nextIndex;
collectingLineEnd = nextIndex;
state = State.CollectingFirstLine;
}
else {
parserContext.log.addMessageForTextRange(TSDocMessageId.CommentOpeningDelimiterSyntax, 'Expecting a leading "/**"', range.getNewRange(currentIndex, currentIndex + 1));
return false;
}
break;
case State.CollectingFirstLine:
case State.CollectingLine:
if (current === '\n') {
// Ignore an empty line if it is immediately after the "/**"
if (state !== State.CollectingFirstLine || collectingLineEnd > collectingLineStart) {
// Record the line that we collected
lines.push(range.getNewRange(collectingLineStart, collectingLineEnd));
}
collectingLineStart = nextIndex;
collectingLineEnd = nextIndex;
state = State.AdvancingLine;
}
else if (current === '*' && next === '/') {
if (collectingLineEnd > collectingLineStart) {
lines.push(range.getNewRange(collectingLineStart, collectingLineEnd));
}
collectingLineStart = 0;
collectingLineEnd = 0;
++nextIndex; // skip the slash
commentRangeEnd = nextIndex;
state = State.Done;
}
else if (!LineExtractor._whitespaceCharacterRegExp.test(current)) {
collectingLineEnd = nextIndex;
}
break;
case State.AdvancingLine:
if (current === '*') {
if (next === '/') {
collectingLineStart = 0;
collectingLineEnd = 0;
++nextIndex; // skip the slash
commentRangeEnd = nextIndex;
state = State.Done;
}
else {
// Discard the "*" at the start of a line
if (next === ' ') {
++nextIndex; // Discard the space after the star
}
collectingLineStart = nextIndex;
collectingLineEnd = nextIndex;
state = State.CollectingLine;
}
}
else if (current === '\n') {
// Blank line
lines.push(range.getNewRange(currentIndex, currentIndex));
collectingLineStart = nextIndex;
}
else if (!LineExtractor._whitespaceCharacterRegExp.test(current)) {
// If the star is missing, then start the line here
// Example: "/**\nL1*/"
// (collectingLineStart was the start of this line)
collectingLineEnd = nextIndex;
state = State.CollectingLine;
}
break;
}
}
/**
* Only fill in these if we successfully scanned a comment
*/
parserContext.commentRange = range.getNewRange(commentRangeStart, commentRangeEnd);
parserContext.lines = lines;
return true;
}
}
LineExtractor._whitespaceCharacterRegExp = /^\s$/;
//# sourceMappingURL=LineExtractor.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,91 @@
import type { ParserContext } from './ParserContext';
/**
* The main parser for TSDoc comments.
*/
export declare class NodeParser {
private readonly _parserContext;
private readonly _configuration;
private _currentSection;
constructor(parserContext: ParserContext);
parse(): void;
private _performValidationChecks;
private _validateTagDefinition;
private _pushAccumulatedPlainText;
private _parseAndPushBlock;
private _addBlockToDocComment;
/**
* Used by `_parseParamBlock()`, this parses a JSDoc expression remainder like `string}` or `="]"]` from
* an input like `@param {string} [x="]"] - the X value`. It detects nested balanced pairs of delimiters
* and escaped string literals.
*/
private _tryParseJSDocTypeOrValueRest;
/**
* Used by `_parseParamBlock()`, this parses a JSDoc expression like `{string}` from
* an input like `@param {string} x - the X value`.
*/
private _tryParseUnsupportedJSDocType;
/**
* Used by `_parseParamBlock()`, this parses a JSDoc expression remainder like `=[]]` from
* an input like `@param {string} [x=[]] - the X value`.
*/
private _tryParseJSDocOptionalNameRest;
private _parseParamBlock;
private _pushNode;
private _parseBackslashEscape;
private _parseBlockTag;
private _parseInlineTag;
private _parseInheritDocTag;
private _parseLinkTag;
private _parseLinkTagUrlDestination;
private _parseLinkTagCodeDestination;
private _parseDeclarationReference;
private _parseMemberReference;
private _parseMemberSymbol;
private _parseMemberIdentifier;
private _parseMemberSelector;
private _parseHtmlStartTag;
private _parseHtmlAttribute;
private _parseHtmlString;
private _parseHtmlEndTag;
/**
* Parses an HTML name such as an element name or attribute name.
*/
private _parseHtmlName;
private _parseFencedCode;
private _parseCodeSpan;
private _tryReadSpacingAndNewlines;
/**
* Read the next token, and report it as a DocErrorText node.
*/
private _createError;
/**
* Rewind to the specified marker, read the next token, and report it as a DocErrorText node.
*/
private _backtrackAndCreateError;
/**
* Rewind to the errorStartMarker, read the tokens up to and including errorInclusiveEndMarker,
* and report it as a DocErrorText node.
*/
private _backtrackAndCreateErrorRange;
/**
* Rewind to the specified marker, read the next token, and report it as a DocErrorText node
* whose location is based on an IFailure.
*/
private _backtrackAndCreateErrorForFailure;
/**
* Rewind to the errorStartMarker, read the tokens up to and including errorInclusiveEndMarker,
* and report it as a DocErrorText node whose location is based on an IFailure.
*/
private _backtrackAndCreateErrorRangeForFailure;
/**
* Creates an IFailure whose TokenSequence is a single token. If a marker is not specified,
* then it is the current token.
*/
private _createFailureForToken;
/**
* Creates an IFailure whose TokenSequence starts from the specified marker and
* encompasses all tokens read since then. If none were read, then the next token used.
*/
private _createFailureForTokensSince;
}
//# sourceMappingURL=NodeParser.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NodeParser.d.ts","sourceRoot":"","sources":["../../src/parser/NodeParser.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA4DrD;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAgB;IAC/C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAqB;IACpD,OAAO,CAAC,eAAe,CAAa;gBAEjB,aAAa,EAAE,aAAa;IAOxC,KAAK,IAAI,IAAI;IA6GpB,OAAO,CAAC,wBAAwB;IAmChC,OAAO,CAAC,sBAAsB;IAqD9B,OAAO,CAAC,yBAAyB;IAYjC,OAAO,CAAC,kBAAkB;IAyE1B,OAAO,CAAC,qBAAqB;IAyB7B;;;;OAIG;IACH,OAAO,CAAC,6BAA6B;IAiDrC;;;OAGG;IACH,OAAO,CAAC,6BAA6B;IA6CrC;;;OAGG;IACH,OAAO,CAAC,8BAA8B;IActC,OAAO,CAAC,gBAAgB;IAoJxB,OAAO,CAAC,SAAS;IAQjB,OAAO,CAAC,qBAAqB;IAyC7B,OAAO,CAAC,cAAc;IAmFtB,OAAO,CAAC,eAAe;IA6LvB,OAAO,CAAC,mBAAmB;IAqC3B,OAAO,CAAC,aAAa;IA0KrB,OAAO,CAAC,2BAA2B;IAkDnC,OAAO,CAAC,4BAA4B;IAepC,OAAO,CAAC,0BAA0B;IAuPlC,OAAO,CAAC,qBAAqB;IAyH7B,OAAO,CAAC,kBAAkB;IA8D1B,OAAO,CAAC,sBAAsB;IAyG9B,OAAO,CAAC,oBAAoB;IAsC5B,OAAO,CAAC,kBAAkB;IA8F1B,OAAO,CAAC,mBAAmB;IAkD3B,OAAO,CAAC,gBAAgB;IA4CxB,OAAO,CAAC,gBAAgB;IAuExB;;OAEG;IACH,OAAO,CAAC,cAAc;IA+DtB,OAAO,CAAC,gBAAgB;IA4OxB,OAAO,CAAC,cAAc;IA8DtB,OAAO,CAAC,0BAA0B;IAgBlC;;OAEG;IACH,OAAO,CAAC,YAAY;IAuBpB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAUhC;;;OAGG;IACH,OAAO,CAAC,6BAA6B;IA+BrC;;;OAGG;IACH,OAAO,CAAC,kCAAkC;IAyB1C;;;OAGG;IACH,OAAO,CAAC,uCAAuC;IA+B/C;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IAuB9B;;;OAGG;IACH,OAAO,CAAC,4BAA4B;CA4BrC"}

1660
node_modules/@microsoft/tsdoc/lib/parser/NodeParser.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,24 @@
import { DocSection, type DocNode } from '../nodes';
/**
* The ParagraphSplitter is a secondary stage that runs after the NodeParser has constructed
* the DocComment. It splits DocParagraph nodes into multiple paragraphs by looking for
* paragraph delimiters. Following CommonMark conventions, paragraphs are delimited by
* one or more blank lines. (These lines end with SoftBreak nodes.) The blank lines are
* not discarded. Instead, they are attached to the preceding paragraph. If the DocParagraph
* starts with blank lines, they are preserved to avoid creating a paragraph containing only
* whitespace.
*/
export declare class ParagraphSplitter {
private static readonly _whitespaceRegExp;
/**
* Split all paragraphs belonging to the provided subtree.
*/
static splitParagraphs(node: DocNode): void;
/**
* Split all paragraphs belonging to the provided DocSection.
*/
static splitParagraphsForSection(docSection: DocSection): void;
private static _splitParagraph;
private static _isWhitespace;
}
//# sourceMappingURL=ParagraphSplitter.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ParagraphSplitter.d.ts","sourceRoot":"","sources":["../../src/parser/ParagraphSplitter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,KAAK,OAAO,EAAgD,MAAM,UAAU,CAAC;AAElG;;;;;;;;GAQG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAmB;IAE5D;;OAEG;WACW,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAYlD;;OAEG;WACW,yBAAyB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IAiBrE,OAAO,CAAC,MAAM,CAAC,eAAe;IAoE9B,OAAO,CAAC,MAAM,CAAC,aAAa;CAS7B"}

View File

@@ -0,0 +1,117 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
import { DocSection, DocNodeKind, DocParagraph } from '../nodes';
/**
* The ParagraphSplitter is a secondary stage that runs after the NodeParser has constructed
* the DocComment. It splits DocParagraph nodes into multiple paragraphs by looking for
* paragraph delimiters. Following CommonMark conventions, paragraphs are delimited by
* one or more blank lines. (These lines end with SoftBreak nodes.) The blank lines are
* not discarded. Instead, they are attached to the preceding paragraph. If the DocParagraph
* starts with blank lines, they are preserved to avoid creating a paragraph containing only
* whitespace.
*/
export class ParagraphSplitter {
/**
* Split all paragraphs belonging to the provided subtree.
*/
static splitParagraphs(node) {
if (node instanceof DocSection) {
ParagraphSplitter.splitParagraphsForSection(node);
// (We don't recurse here, since sections cannot contain subsections)
}
else {
for (const childNode of node.getChildNodes()) {
ParagraphSplitter.splitParagraphs(childNode);
}
}
}
/**
* Split all paragraphs belonging to the provided DocSection.
*/
static splitParagraphsForSection(docSection) {
const inputNodes = docSection.nodes;
const outputNodes = [];
for (const oldNode of inputNodes) {
if (oldNode.kind === DocNodeKind.Paragraph) {
ParagraphSplitter._splitParagraph(oldNode, outputNodes);
}
else {
outputNodes.push(oldNode);
}
}
// Replace the inputNodes with the outputNodes
docSection.clearNodes();
docSection.appendNodes(outputNodes);
}
static _splitParagraph(oldParagraph, outputNodes) {
const inputParagraphNodes = oldParagraph.nodes;
let currentParagraph = new DocParagraph({ configuration: oldParagraph.configuration });
outputNodes.push(currentParagraph);
let SplitterState;
(function (SplitterState) {
SplitterState[SplitterState["Start"] = 0] = "Start";
SplitterState[SplitterState["AwaitingTrailer"] = 1] = "AwaitingTrailer";
SplitterState[SplitterState["ReadingTrailer"] = 2] = "ReadingTrailer";
})(SplitterState || (SplitterState = {}));
let state = SplitterState.Start;
let currentIndex = 0;
while (currentIndex < inputParagraphNodes.length) {
// Scan forwards to the end of the line
let isBlankLine = true;
let lineEndIndex = currentIndex; // non-inclusive
do {
const node = inputParagraphNodes[lineEndIndex++];
if (node.kind === DocNodeKind.SoftBreak) {
break;
}
if (isBlankLine) {
if (!this._isWhitespace(node)) {
isBlankLine = false;
}
}
} while (lineEndIndex < inputParagraphNodes.length);
// At this point, the line and SoftBreak will be in inputParagraphNodes.slice(currentIndex, lineEndIndex)
switch (state) {
case SplitterState.Start:
// We're skipping any blank lines that start the first paragraph
if (!isBlankLine) {
state = SplitterState.AwaitingTrailer;
}
break;
case SplitterState.AwaitingTrailer:
// We already saw some content, so now we're looking for a blank line that starts the trailer
// at the end of this paragraph
if (isBlankLine) {
state = SplitterState.ReadingTrailer;
}
break;
case SplitterState.ReadingTrailer:
// We already found the trailer, so now we're looking for a non-blank line that will
// begin a new paragraph
if (!isBlankLine) {
// Start a new paragraph
currentParagraph = new DocParagraph({ configuration: oldParagraph.configuration });
outputNodes.push(currentParagraph);
state = SplitterState.AwaitingTrailer;
}
break;
}
// Append the line onto the current paragraph
for (let i = currentIndex; i < lineEndIndex; ++i) {
currentParagraph.appendNode(inputParagraphNodes[i]);
}
currentIndex = lineEndIndex;
}
}
static _isWhitespace(node) {
switch (node.kind) {
case DocNodeKind.PlainText:
const docPlainText = node;
return ParagraphSplitter._whitespaceRegExp.test(docPlainText.text);
default:
return false;
}
}
}
ParagraphSplitter._whitespaceRegExp = /^\s*$/;
//# sourceMappingURL=ParagraphSplitter.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,42 @@
import { TextRange } from './TextRange';
import type { Token } from './Token';
import { DocComment } from '../nodes';
import type { TSDocConfiguration } from '../configuration/TSDocConfiguration';
import { ParserMessageLog } from './ParserMessageLog';
/**
* An internal data structure that tracks all the state being built up by the various
* parser stages.
*/
export declare class ParserContext {
/**
* The configuration that was provided for the TSDocParser.
*/
readonly configuration: TSDocConfiguration;
/**
* The `sourceRange` indicates the start and end of the original input that was parsed.
*/
readonly sourceRange: TextRange;
/**
* The text range starting from the opening `/**` and ending with
* the closing `*\/` delimiter.
*/
commentRange: TextRange;
/**
* The text ranges corresponding to the lines of content inside the comment.
*/
lines: TextRange[];
/**
* A complete list of all tokens that were extracted from the input lines.
*/
tokens: Token[];
/**
* The parsed doc comment object. This is the primary output of the parser.
*/
readonly docComment: DocComment;
/**
* A queryable log that reports warnings and error messages that occurred during parsing.
*/
readonly log: ParserMessageLog;
constructor(configuration: TSDocConfiguration, sourceRange: TextRange);
}
//# sourceMappingURL=ParserContext.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ParserContext.d.ts","sourceRoot":"","sources":["../../src/parser/ParserContext.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;GAGG;AACH,qBAAa,aAAa;IACxB;;OAEG;IACH,SAAgB,aAAa,EAAE,kBAAkB,CAAC;IAElD;;OAEG;IACH,SAAgB,WAAW,EAAE,SAAS,CAAC;IAEvC;;;OAGG;IACI,YAAY,EAAE,SAAS,CAAmB;IAEjD;;OAEG;IACI,KAAK,EAAE,SAAS,EAAE,CAAM;IAE/B;;OAEG;IACI,MAAM,EAAE,KAAK,EAAE,CAAM;IAE5B;;OAEG;IACH,SAAgB,UAAU,EAAE,UAAU,CAAC;IAEvC;;OAEG;IACH,SAAgB,GAAG,EAAE,gBAAgB,CAAC;gBAEnB,aAAa,EAAE,kBAAkB,EAAE,WAAW,EAAE,SAAS;CAQ7E"}

View File

@@ -0,0 +1,31 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
import { TextRange } from './TextRange';
import { DocComment } from '../nodes';
import { ParserMessageLog } from './ParserMessageLog';
/**
* An internal data structure that tracks all the state being built up by the various
* parser stages.
*/
export class ParserContext {
constructor(configuration, sourceRange) {
/**
* The text range starting from the opening `/**` and ending with
* the closing `*\/` delimiter.
*/
this.commentRange = TextRange.empty;
/**
* The text ranges corresponding to the lines of content inside the comment.
*/
this.lines = [];
/**
* A complete list of all tokens that were extracted from the input lines.
*/
this.tokens = [];
this.configuration = configuration;
this.sourceRange = sourceRange;
this.docComment = new DocComment({ configuration: this.configuration });
this.log = new ParserMessageLog();
}
}
//# sourceMappingURL=ParserContext.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ParserContext.js","sourceRoot":"","sources":["../../src/parser/ParserContext.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;GAGG;AACH,MAAM,OAAO,aAAa;IAqCxB,YAAmB,aAAiC,EAAE,WAAsB;QA1B5E;;;WAGG;QACI,iBAAY,GAAc,SAAS,CAAC,KAAK,CAAC;QAEjD;;WAEG;QACI,UAAK,GAAgB,EAAE,CAAC;QAE/B;;WAEG;QACI,WAAM,GAAY,EAAE,CAAC;QAa1B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAE/B,IAAI,CAAC,UAAU,GAAG,IAAI,UAAU,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;QAExE,IAAI,CAAC,GAAG,GAAG,IAAI,gBAAgB,EAAE,CAAC;IACpC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport { TextRange } from './TextRange';\r\nimport type { Token } from './Token';\r\nimport { DocComment } from '../nodes';\r\nimport type { TSDocConfiguration } from '../configuration/TSDocConfiguration';\r\nimport { ParserMessageLog } from './ParserMessageLog';\r\n\r\n/**\r\n * An internal data structure that tracks all the state being built up by the various\r\n * parser stages.\r\n */\r\nexport class ParserContext {\r\n /**\r\n * The configuration that was provided for the TSDocParser.\r\n */\r\n public readonly configuration: TSDocConfiguration;\r\n\r\n /**\r\n * The `sourceRange` indicates the start and end of the original input that was parsed.\r\n */\r\n public readonly sourceRange: TextRange;\r\n\r\n /**\r\n * The text range starting from the opening `/**` and ending with\r\n * the closing `*\\/` delimiter.\r\n */\r\n public commentRange: TextRange = TextRange.empty;\r\n\r\n /**\r\n * The text ranges corresponding to the lines of content inside the comment.\r\n */\r\n public lines: TextRange[] = [];\r\n\r\n /**\r\n * A complete list of all tokens that were extracted from the input lines.\r\n */\r\n public tokens: Token[] = [];\r\n\r\n /**\r\n * The parsed doc comment object. This is the primary output of the parser.\r\n */\r\n public readonly docComment: DocComment;\r\n\r\n /**\r\n * A queryable log that reports warnings and error messages that occurred during parsing.\r\n */\r\n public readonly log: ParserMessageLog;\r\n\r\n public constructor(configuration: TSDocConfiguration, sourceRange: TextRange) {\r\n this.configuration = configuration;\r\n this.sourceRange = sourceRange;\r\n\r\n this.docComment = new DocComment({ configuration: this.configuration });\r\n\r\n this.log = new ParserMessageLog();\r\n }\r\n}\r\n"]}

View File

@@ -0,0 +1,46 @@
import type { TextRange } from './TextRange';
import type { TokenSequence } from './TokenSequence';
import type { DocNode } from '../nodes/DocNode';
import type { TSDocMessageId } from './TSDocMessageId';
/**
* Constructor parameters for {@link ParserMessage}.
*/
export interface IParserMessageParameters {
messageId: TSDocMessageId;
messageText: string;
textRange: TextRange;
tokenSequence?: TokenSequence;
docNode?: DocNode;
}
/**
* Represents an error or warning that occurred during parsing.
*/
export declare class ParserMessage {
/**
* A string that uniquely identifies the messages reported by the TSDoc parser.
*/
readonly messageId: TSDocMessageId;
/**
* The message text without the default prefix that shows line/column information.
*/
readonly unformattedText: string;
readonly textRange: TextRange;
readonly tokenSequence: TokenSequence | undefined;
readonly docNode: DocNode | undefined;
private _text;
constructor(parameters: IParserMessageParameters);
/**
* Generates a line/column prefix. Example with line=2 and column=5
* and message="An error occurred":
* ```
* "(2,5): An error occurred"
* ```
*/
private static _formatMessageText;
/**
* The message text.
*/
get text(): string;
toString(): string;
}
//# sourceMappingURL=ParserMessage.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ParserMessage.d.ts","sourceRoot":"","sources":["../../src/parser/ParserMessage.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAiB,MAAM,aAAa,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,cAAc,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,SAAS,CAAC;IACrB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,aAAa;IACxB;;OAEG;IACH,SAAgB,SAAS,EAAE,cAAc,CAAC;IAE1C;;OAEG;IACH,SAAgB,eAAe,EAAE,MAAM,CAAC;IAExC,SAAgB,SAAS,EAAE,SAAS,CAAC;IAErC,SAAgB,aAAa,EAAE,aAAa,GAAG,SAAS,CAAC;IAEzD,SAAgB,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAE7C,OAAO,CAAC,KAAK,CAAqB;gBAEf,UAAU,EAAE,wBAAwB;IASvD;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAgBjC;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAOxB;IAEM,QAAQ,IAAI,MAAM;CAG1B"}

View File

@@ -0,0 +1,51 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
/**
* Represents an error or warning that occurred during parsing.
*/
export class ParserMessage {
constructor(parameters) {
this.messageId = parameters.messageId;
this.unformattedText = parameters.messageText;
this.textRange = parameters.textRange;
this.tokenSequence = parameters.tokenSequence;
this.docNode = parameters.docNode;
this._text = undefined;
}
/**
* Generates a line/column prefix. Example with line=2 and column=5
* and message="An error occurred":
* ```
* "(2,5): An error occurred"
* ```
*/
static _formatMessageText(message, range) {
if (!message) {
message = 'An unknown error occurred';
}
if (range.pos !== 0 || range.end !== 0) {
// NOTE: This currently a potentially expensive operation, since TSDoc currently doesn't
// have a full newline analysis for the input buffer.
const location = range.getLocation(range.pos);
if (location.line) {
return `(${location.line},${location.column}): ` + message;
}
}
return message;
}
/**
* The message text.
*/
get text() {
if (this._text === undefined) {
// NOTE: This currently a potentially expensive operation, since TSDoc currently doesn't
// have a full newline analysis for the input buffer.
this._text = ParserMessage._formatMessageText(this.unformattedText, this.textRange);
}
return this._text;
}
toString() {
return this.text;
}
}
//# sourceMappingURL=ParserMessage.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ParserMessage.js","sourceRoot":"","sources":["../../src/parser/ParserMessage.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAkB3D;;GAEG;AACH,MAAM,OAAO,aAAa;IAmBxB,YAAmB,UAAoC;QACrD,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,eAAe,GAAG,UAAU,CAAC,WAAW,CAAC;QAC9C,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,aAAa,CAAC;QAC9C,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IACzB,CAAC;IAED;;;;;;OAMG;IACK,MAAM,CAAC,kBAAkB,CAAC,OAAe,EAAE,KAAgB;QACjE,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,GAAG,2BAA2B,CAAC;QACxC,CAAC;QAED,IAAI,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC;YACvC,wFAAwF;YACxF,qDAAqD;YACrD,MAAM,QAAQ,GAAkB,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC7D,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;gBAClB,OAAO,IAAI,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC;YAC7D,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;OAEG;IACH,IAAW,IAAI;QACb,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAC7B,wFAAwF;YACxF,qDAAqD;YACrD,IAAI,CAAC,KAAK,GAAG,aAAa,CAAC,kBAAkB,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACtF,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport type { TextRange, ITextLocation } from './TextRange';\r\nimport type { TokenSequence } from './TokenSequence';\r\nimport type { DocNode } from '../nodes/DocNode';\r\nimport type { TSDocMessageId } from './TSDocMessageId';\r\n\r\n/**\r\n * Constructor parameters for {@link ParserMessage}.\r\n */\r\nexport interface IParserMessageParameters {\r\n messageId: TSDocMessageId;\r\n messageText: string;\r\n textRange: TextRange;\r\n tokenSequence?: TokenSequence;\r\n docNode?: DocNode;\r\n}\r\n\r\n/**\r\n * Represents an error or warning that occurred during parsing.\r\n */\r\nexport class ParserMessage {\r\n /**\r\n * A string that uniquely identifies the messages reported by the TSDoc parser.\r\n */\r\n public readonly messageId: TSDocMessageId;\r\n\r\n /**\r\n * The message text without the default prefix that shows line/column information.\r\n */\r\n public readonly unformattedText: string;\r\n\r\n public readonly textRange: TextRange;\r\n\r\n public readonly tokenSequence: TokenSequence | undefined;\r\n\r\n public readonly docNode: DocNode | undefined;\r\n\r\n private _text: string | undefined;\r\n\r\n public constructor(parameters: IParserMessageParameters) {\r\n this.messageId = parameters.messageId;\r\n this.unformattedText = parameters.messageText;\r\n this.textRange = parameters.textRange;\r\n this.tokenSequence = parameters.tokenSequence;\r\n this.docNode = parameters.docNode;\r\n this._text = undefined;\r\n }\r\n\r\n /**\r\n * Generates a line/column prefix. Example with line=2 and column=5\r\n * and message=\"An error occurred\":\r\n * ```\r\n * \"(2,5): An error occurred\"\r\n * ```\r\n */\r\n private static _formatMessageText(message: string, range: TextRange): string {\r\n if (!message) {\r\n message = 'An unknown error occurred';\r\n }\r\n\r\n if (range.pos !== 0 || range.end !== 0) {\r\n // NOTE: This currently a potentially expensive operation, since TSDoc currently doesn't\r\n // have a full newline analysis for the input buffer.\r\n const location: ITextLocation = range.getLocation(range.pos);\r\n if (location.line) {\r\n return `(${location.line},${location.column}): ` + message;\r\n }\r\n }\r\n return message;\r\n }\r\n\r\n /**\r\n * The message text.\r\n */\r\n public get text(): string {\r\n if (this._text === undefined) {\r\n // NOTE: This currently a potentially expensive operation, since TSDoc currently doesn't\r\n // have a full newline analysis for the input buffer.\r\n this._text = ParserMessage._formatMessageText(this.unformattedText, this.textRange);\r\n }\r\n return this._text;\r\n }\r\n\r\n public toString(): string {\r\n return this.text;\r\n }\r\n}\r\n"]}

View File

@@ -0,0 +1,33 @@
import { ParserMessage } from './ParserMessage';
import type { TextRange } from './TextRange';
import type { TokenSequence } from './TokenSequence';
import type { DocNode } from '../nodes/DocNode';
import type { DocErrorText } from '../nodes/DocErrorText';
import type { TSDocMessageId } from './TSDocMessageId';
/**
* Used to report errors and warnings that occurred during parsing.
*/
export declare class ParserMessageLog {
private _messages;
/**
* The unfiltered list of all messages.
*/
get messages(): ReadonlyArray<ParserMessage>;
/**
* Append a message to the log.
*/
addMessage(parserMessage: ParserMessage): void;
/**
* Append a message associated with a TextRange.
*/
addMessageForTextRange(messageId: TSDocMessageId, messageText: string, textRange: TextRange): void;
/**
* Append a message associated with a TokenSequence.
*/
addMessageForTokenSequence(messageId: TSDocMessageId, messageText: string, tokenSequence: TokenSequence, docNode?: DocNode): void;
/**
* Append a message associated with a TokenSequence.
*/
addMessageForDocErrorText(docErrorText: DocErrorText): void;
}
//# sourceMappingURL=ParserMessageLog.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ParserMessageLog.d.ts","sourceRoot":"","sources":["../../src/parser/ParserMessageLog.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,SAAS,CAAuB;IAExC;;OAEG;IACH,IAAW,QAAQ,IAAI,aAAa,CAAC,aAAa,CAAC,CAElD;IAED;;OAEG;IACI,UAAU,CAAC,aAAa,EAAE,aAAa,GAAG,IAAI;IAIrD;;OAEG;IACI,sBAAsB,CAAC,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI;IAUzG;;OAEG;IACI,0BAA0B,CAC/B,SAAS,EAAE,cAAc,EACzB,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,aAAa,EAC5B,OAAO,CAAC,EAAE,OAAO,GAChB,IAAI;IAYP;;OAEG;IACI,yBAAyB,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI;CAsBnE"}

View File

@@ -0,0 +1,68 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
import { ParserMessage } from './ParserMessage';
/**
* Used to report errors and warnings that occurred during parsing.
*/
export class ParserMessageLog {
constructor() {
this._messages = [];
}
/**
* The unfiltered list of all messages.
*/
get messages() {
return this._messages;
}
/**
* Append a message to the log.
*/
addMessage(parserMessage) {
this._messages.push(parserMessage);
}
/**
* Append a message associated with a TextRange.
*/
addMessageForTextRange(messageId, messageText, textRange) {
this.addMessage(new ParserMessage({
messageId,
messageText,
textRange
}));
}
/**
* Append a message associated with a TokenSequence.
*/
addMessageForTokenSequence(messageId, messageText, tokenSequence, docNode) {
this.addMessage(new ParserMessage({
messageId,
messageText,
textRange: tokenSequence.getContainingTextRange(),
tokenSequence,
docNode
}));
}
/**
* Append a message associated with a TokenSequence.
*/
addMessageForDocErrorText(docErrorText) {
let tokenSequence;
if (docErrorText.textExcerpt) {
// If there is an excerpt directly associated with the DocErrorText, highlight that:
tokenSequence = docErrorText.textExcerpt;
}
else {
// Otherwise we can use the errorLocation, but typically that is meant to give additional
// details, not to indicate the primary location of the problem.
tokenSequence = docErrorText.errorLocation;
}
this.addMessage(new ParserMessage({
messageId: docErrorText.messageId,
messageText: docErrorText.errorMessage,
textRange: tokenSequence.getContainingTextRange(),
tokenSequence: tokenSequence,
docNode: docErrorText
}));
}
}
//# sourceMappingURL=ParserMessageLog.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ParserMessageLog.js","sourceRoot":"","sources":["../../src/parser/ParserMessageLog.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAOhD;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAA7B;QACU,cAAS,GAAoB,EAAE,CAAC;IA0E1C,CAAC;IAxEC;;OAEG;IACH,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;OAEG;IACI,UAAU,CAAC,aAA4B;QAC5C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACI,sBAAsB,CAAC,SAAyB,EAAE,WAAmB,EAAE,SAAoB;QAChG,IAAI,CAAC,UAAU,CACb,IAAI,aAAa,CAAC;YAChB,SAAS;YACT,WAAW;YACX,SAAS;SACV,CAAC,CACH,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,0BAA0B,CAC/B,SAAyB,EACzB,WAAmB,EACnB,aAA4B,EAC5B,OAAiB;QAEjB,IAAI,CAAC,UAAU,CACb,IAAI,aAAa,CAAC;YAChB,SAAS;YACT,WAAW;YACX,SAAS,EAAE,aAAa,CAAC,sBAAsB,EAAE;YACjD,aAAa;YACb,OAAO;SACR,CAAC,CACH,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,yBAAyB,CAAC,YAA0B;QACzD,IAAI,aAA4B,CAAC;QAEjC,IAAI,YAAY,CAAC,WAAW,EAAE,CAAC;YAC7B,oFAAoF;YACpF,aAAa,GAAG,YAAY,CAAC,WAAW,CAAC;QAC3C,CAAC;aAAM,CAAC;YACN,yFAAyF;YACzF,gEAAgE;YAChE,aAAa,GAAG,YAAY,CAAC,aAAa,CAAC;QAC7C,CAAC;QAED,IAAI,CAAC,UAAU,CACb,IAAI,aAAa,CAAC;YAChB,SAAS,EAAE,YAAY,CAAC,SAAS;YACjC,WAAW,EAAE,YAAY,CAAC,YAAY;YACtC,SAAS,EAAE,aAAa,CAAC,sBAAsB,EAAE;YACjD,aAAa,EAAE,aAAa;YAC5B,OAAO,EAAE,YAAY;SACtB,CAAC,CACH,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport { ParserMessage } from './ParserMessage';\r\nimport type { TextRange } from './TextRange';\r\nimport type { TokenSequence } from './TokenSequence';\r\nimport type { DocNode } from '../nodes/DocNode';\r\nimport type { DocErrorText } from '../nodes/DocErrorText';\r\nimport type { TSDocMessageId } from './TSDocMessageId';\r\n\r\n/**\r\n * Used to report errors and warnings that occurred during parsing.\r\n */\r\nexport class ParserMessageLog {\r\n private _messages: ParserMessage[] = [];\r\n\r\n /**\r\n * The unfiltered list of all messages.\r\n */\r\n public get messages(): ReadonlyArray<ParserMessage> {\r\n return this._messages;\r\n }\r\n\r\n /**\r\n * Append a message to the log.\r\n */\r\n public addMessage(parserMessage: ParserMessage): void {\r\n this._messages.push(parserMessage);\r\n }\r\n\r\n /**\r\n * Append a message associated with a TextRange.\r\n */\r\n public addMessageForTextRange(messageId: TSDocMessageId, messageText: string, textRange: TextRange): void {\r\n this.addMessage(\r\n new ParserMessage({\r\n messageId,\r\n messageText,\r\n textRange\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Append a message associated with a TokenSequence.\r\n */\r\n public addMessageForTokenSequence(\r\n messageId: TSDocMessageId,\r\n messageText: string,\r\n tokenSequence: TokenSequence,\r\n docNode?: DocNode\r\n ): void {\r\n this.addMessage(\r\n new ParserMessage({\r\n messageId,\r\n messageText,\r\n textRange: tokenSequence.getContainingTextRange(),\r\n tokenSequence,\r\n docNode\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Append a message associated with a TokenSequence.\r\n */\r\n public addMessageForDocErrorText(docErrorText: DocErrorText): void {\r\n let tokenSequence: TokenSequence;\r\n\r\n if (docErrorText.textExcerpt) {\r\n // If there is an excerpt directly associated with the DocErrorText, highlight that:\r\n tokenSequence = docErrorText.textExcerpt;\r\n } else {\r\n // Otherwise we can use the errorLocation, but typically that is meant to give additional\r\n // details, not to indicate the primary location of the problem.\r\n tokenSequence = docErrorText.errorLocation;\r\n }\r\n\r\n this.addMessage(\r\n new ParserMessage({\r\n messageId: docErrorText.messageId,\r\n messageText: docErrorText.errorMessage,\r\n textRange: tokenSequence.getContainingTextRange(),\r\n tokenSequence: tokenSequence,\r\n docNode: docErrorText\r\n })\r\n );\r\n }\r\n}\r\n"]}

View File

@@ -0,0 +1,62 @@
/**
* Helpers for validating various text string formats.
*/
export declare class StringChecks {
private static readonly _tsdocTagNameRegExp;
private static readonly _urlSchemeRegExp;
private static readonly _urlSchemeAfterRegExp;
private static readonly _htmlNameRegExp;
private static readonly _identifierBadCharRegExp;
private static readonly _identifierNumberStartRegExp;
private static readonly _validPackageNameRegExp;
private static readonly _systemSelectors;
/**
* Tests whether the input string is a valid TSDoc tag name; if not, returns an error message.
* TSDoc tag names start with an at-sign ("@") followed by ASCII letters using
* "camelCase" capitalization.
*/
static explainIfInvalidTSDocTagName(tagName: string): string | undefined;
/**
* Throws an exception if the input string is not a valid TSDoc tag name.
* TSDoc tag names start with an at-sign ("@") followed by ASCII letters using
* "camelCase" capitalization.
*/
static validateTSDocTagName(tagName: string): void;
/**
* Tests whether the input string is a URL form supported inside an "@link" tag; if not,
* returns an error message.
*/
static explainIfInvalidLinkUrl(url: string): string | undefined;
/**
* Tests whether the input string is a valid HTML element or attribute name.
*/
static explainIfInvalidHtmlName(htmlName: string): string | undefined;
/**
* Throws an exception if the input string is a not valid HTML element or attribute name.
*/
static validateHtmlName(htmlName: string): void;
/**
* Tests whether the input string is a valid NPM package name.
*/
static explainIfInvalidPackageName(packageName: string): string | undefined;
/**
* Tests whether the input string is a valid declaration reference import path.
*/
static explainIfInvalidImportPath(importPath: string, prefixedByPackageName: boolean): string | undefined;
/**
* Returns true if the input string is a TSDoc system selector.
*/
static isSystemSelector(selector: string): boolean;
/**
* Tests whether the input string is a valid ECMAScript identifier.
* A precise check is extremely complicated and highly dependent on the standard version
* and how faithfully the interpreter implements it, so here we use a conservative heuristic.
*/
static explainIfInvalidUnquotedIdentifier(identifier: string): string | undefined;
/**
* Tests whether the input string can be used without quotes as a member identifier in a declaration reference.
* If not, it should be enclosed in quotes.
*/
static explainIfInvalidUnquotedMemberIdentifier(identifier: string): string | undefined;
}
//# sourceMappingURL=StringChecks.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"StringChecks.d.ts","sourceRoot":"","sources":["../../src/parser/StringChecks.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAgC;IAE3E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAoC;IAC5E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,CAAqC;IASlF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAkC;IAMzE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAA0B;IAG1E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,4BAA4B,CAAoB;IAKxE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,uBAAuB,CAAqD;IAEpG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAcrC;IAEH;;;;OAIG;WACW,4BAA4B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAY/E;;;;OAIG;WACW,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAOzD;;;OAGG;WACW,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAiBtE;;OAEG;WACW,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAQ5E;;OAEG;WACW,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAOtD;;OAEG;WACW,2BAA2B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAYlF;;OAEG;WACW,0BAA0B,CACtC,UAAU,EAAE,MAAM,EAClB,qBAAqB,EAAE,OAAO,GAC7B,MAAM,GAAG,SAAS;IAmBrB;;OAEG;WACW,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIzD;;;;OAIG;WACW,kCAAkC,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAgBxF;;;OAGG;WACW,wCAAwC,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAe/F"}

View File

@@ -0,0 +1,175 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
/**
* Helpers for validating various text string formats.
*/
export class StringChecks {
/**
* Tests whether the input string is a valid TSDoc tag name; if not, returns an error message.
* TSDoc tag names start with an at-sign ("@") followed by ASCII letters using
* "camelCase" capitalization.
*/
static explainIfInvalidTSDocTagName(tagName) {
if (tagName[0] !== '@') {
return 'A TSDoc tag name must start with an "@" symbol';
}
if (!StringChecks._tsdocTagNameRegExp.test(tagName)) {
return 'A TSDoc tag name must start with a letter and contain only letters and numbers';
}
return undefined;
}
/**
* Throws an exception if the input string is not a valid TSDoc tag name.
* TSDoc tag names start with an at-sign ("@") followed by ASCII letters using
* "camelCase" capitalization.
*/
static validateTSDocTagName(tagName) {
const explanation = StringChecks.explainIfInvalidTSDocTagName(tagName);
if (explanation) {
throw new Error(explanation);
}
}
/**
* Tests whether the input string is a URL form supported inside an "@link" tag; if not,
* returns an error message.
*/
static explainIfInvalidLinkUrl(url) {
if (url.length === 0) {
return 'The URL cannot be empty';
}
if (!StringChecks._urlSchemeRegExp.test(url)) {
return ('An @link URL must begin with a scheme comprised only of letters and numbers followed by "://".' +
' (For general URLs, use an HTML "<a>" tag instead.)');
}
if (!StringChecks._urlSchemeAfterRegExp.test(url)) {
return 'An @link URL must have at least one character after "://"';
}
return undefined;
}
/**
* Tests whether the input string is a valid HTML element or attribute name.
*/
static explainIfInvalidHtmlName(htmlName) {
if (!StringChecks._htmlNameRegExp.test(htmlName)) {
return 'An HTML name must be an ASCII letter followed by zero or more letters, digits, or hyphens';
}
return undefined;
}
/**
* Throws an exception if the input string is a not valid HTML element or attribute name.
*/
static validateHtmlName(htmlName) {
const explanation = StringChecks.explainIfInvalidHtmlName(htmlName);
if (explanation) {
throw new Error(explanation);
}
}
/**
* Tests whether the input string is a valid NPM package name.
*/
static explainIfInvalidPackageName(packageName) {
if (packageName.length === 0) {
return 'The package name cannot be an empty string';
}
if (!StringChecks._validPackageNameRegExp.test(packageName)) {
return `The package name ${JSON.stringify(packageName)} is not a valid package name`;
}
return undefined;
}
/**
* Tests whether the input string is a valid declaration reference import path.
*/
static explainIfInvalidImportPath(importPath, prefixedByPackageName) {
if (importPath.length > 0) {
if (importPath.indexOf('//') >= 0) {
return 'An import path must not contain "//"';
}
if (importPath[importPath.length - 1] === '/') {
return 'An import path must not end with "/"';
}
if (!prefixedByPackageName) {
if (importPath[0] === '/') {
return 'An import path must not start with "/" unless prefixed by a package name';
}
}
}
return undefined;
}
/**
* Returns true if the input string is a TSDoc system selector.
*/
static isSystemSelector(selector) {
return StringChecks._systemSelectors.has(selector);
}
/**
* Tests whether the input string is a valid ECMAScript identifier.
* A precise check is extremely complicated and highly dependent on the standard version
* and how faithfully the interpreter implements it, so here we use a conservative heuristic.
*/
static explainIfInvalidUnquotedIdentifier(identifier) {
if (identifier.length === 0) {
return 'The identifier cannot be an empty string';
}
if (StringChecks._identifierBadCharRegExp.test(identifier)) {
return 'The identifier cannot non-word characters';
}
if (StringChecks._identifierNumberStartRegExp.test(identifier)) {
return 'The identifier must not start with a number';
}
return undefined;
}
/**
* Tests whether the input string can be used without quotes as a member identifier in a declaration reference.
* If not, it should be enclosed in quotes.
*/
static explainIfInvalidUnquotedMemberIdentifier(identifier) {
const explanation = StringChecks.explainIfInvalidUnquotedIdentifier(identifier);
if (explanation !== undefined) {
return explanation;
}
if (StringChecks.isSystemSelector(identifier)) {
// We do this to avoid confusion about the declaration reference syntax rules.
// For example if someone were to see "MyClass.(static:instance)" it would be unclear which
// side the colon is the selector.
return `The identifier "${identifier}" must be quoted because it is a TSDoc system selector name`;
}
return undefined;
}
}
StringChecks._tsdocTagNameRegExp = /^@[a-z][a-z0-9]*$/i;
StringChecks._urlSchemeRegExp = /^[a-z][a-z0-9]*\:\/\//i;
StringChecks._urlSchemeAfterRegExp = /^[a-z][a-z0-9]*\:\/\/./i;
// HTML element definitions:
// https://spec.commonmark.org/0.29/#tag-name
// https://www.w3.org/TR/html5/syntax.html#tag-name
// https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
//
// We use the CommonMark spec:
// "A tag name consists of an ASCII letter followed by zero or more ASCII letters, digits, or hyphens (-)."
StringChecks._htmlNameRegExp = /^[a-z]+[a-z0-9\-]*$/i;
// Note: In addition to letters, numbers, underscores, and dollar signs, modern ECMAScript
// also allows Unicode categories such as letters, combining marks, digits, and connector punctuation.
// These are mostly supported in all environments except IE11, so if someone wants it, we would accept
// a PR to allow them (although the test surface might be somewhat large).
StringChecks._identifierBadCharRegExp = /[^a-z0-9_$]/i;
// Identifiers most not start with a number.
StringChecks._identifierNumberStartRegExp = /^[0-9]/;
// For detailed notes about NPM package name syntax, see:
// tslint:disable-next-line:max-line-length
// https://github.com/Microsoft/web-build-tools/blob/a417ca25c63aca31dba43a34d39cc9cd529b9c78/libraries/node-core-library/src/PackageName.ts
StringChecks._validPackageNameRegExp = /^(?:@[a-z0-9\-_\.]+\/)?[a-z0-9\-_\.]+$/i;
StringChecks._systemSelectors = new Set([
// For classes:
'instance',
'static',
'constructor',
// For merged declarations:
'class',
'enum',
'function',
'interface',
'namespace',
'type',
'variable'
]);
//# sourceMappingURL=StringChecks.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,346 @@
/**
* Unique identifiers for messages reported by the TSDoc parser.
*
* @remarks
*
* These strings are possible values for the {@link ParserMessage.messageId} property.
* These identifiers can be used to suppress or configure the reporting of individual messages.
* They are also useful when searching for help about a particular error.
*
* @public
*/
export declare enum TSDocMessageId {
/**
* File not found
* @remarks
* Reported by the `@microsoft/tsdoc-config` package when it failed to find a `tsdoc.json` file.
*/
ConfigFileNotFound = "tsdoc-config-file-not-found",
/**
* Error parsing JSON input: ___
* @remarks
* Reported by the `@microsoft/tsdoc-config` package when the `tsdoc.json` file has invalid JSON syntax.
*/
ConfigInvalidJson = "tsdoc-config-invalid-json",
/**
* Unsupported JSON "$schema" value
* @remarks
* Reported by the `@microsoft/tsdoc-config` package when the file format is not supported.
*/
ConfigFileUnsupportedSchema = "tsdoc-config-unsupported-schema",
/**
* Error loading config file: ___
* @remarks
* Reported by the `@microsoft/tsdoc-config` package when the config file doesn't conform to its schema.
*/
ConfigFileSchemaError = "tsdoc-config-schema-error",
/**
* Circular reference encountered for "extends" field of "___"
* @remarks
* Reported by the `@microsoft/tsdoc-config` package when the "extends" field creates a chain of references
* that causes a file to indirectly extend itself.
*/
ConfigFileCyclicExtends = "tsdoc-config-cyclic-extends",
/**
* Unable to resolve "extends" reference to "___"
* @remarks
* Reported by the `@microsoft/tsdoc-config` package when module resolution fails for the "extends" field.
*/
ConfigFileUnresolvedExtends = "tsdoc-config-unresolved-extends",
/**
* The "supportForTags" field refers to an undefined tag "___".
* @remarks
* Reported by the `@microsoft/tsdoc-config` package when loading the tsdoc.json config file.
*/
ConfigFileUndefinedTag = "tsdoc-config-undefined-tag",
/**
* The "tagDefinitions" field specifies more than one tag with the name "___".
* @remarks
* Reported by the `@microsoft/tsdoc-config` package when loading the tsdoc.json config file.
*/
ConfigFileDuplicateTagName = "tsdoc-config-duplicate-tag-name",
/**
* A TSDoc tag name must start with a letter and contain only letters and numbers.
* @remarks
* Reported by the `@microsoft/tsdoc-config` package when loading the tsdoc.json config file.
*/
ConfigFileInvalidTagName = "tsdoc-config-invalid-tag-name",
/**
* Expecting a `/**` comment.
* Unexpected end of input.
*/
CommentNotFound = "tsdoc-comment-not-found",
/**
* Expecting a leading `/**`
*/
CommentOpeningDelimiterSyntax = "tsdoc-comment-missing-opening-delimiter",
/**
* Unexpected end of input.
*/
CommentMissingClosingDelimiter = "tsdoc-comment-missing-closing-delimiter",
/**
* A doc comment cannot have more than one `@inheritDoc` tag
*/
ExtraInheritDocTag = "tsdoc-extra-inheritdoc-tag",
/**
* The `}` character should be escaped using a backslash to avoid confusion with a TSDoc inline tag.
*/
EscapeRightBrace = "tsdoc-escape-right-brace",
/**
* The `>` character should be escaped using a backslash to avoid confusion with an HTML tag.
*/
EscapeGreaterThan = "tsdoc-escape-greater-than",
/**
* The ___ block must include a deprecation message, e.g. describing the recommended alternative.
*/
MissingDeprecationMessage = "tsdoc-missing-deprecation-message",
/**
* A ___ block must not be used, because that content is provided by the `@inheritDoc` tag.
*/
InheritDocIncompatibleTag = "tsdoc-inheritdoc-incompatible-tag",
/**
* The summary section must not have any content, because that content is provided by the `@inheritDoc` tag.
*/
InheritDocIncompatibleSummary = "tsdoc-inheritdoc-incompatible-summary",
/**
* The TSDoc tag ___ is an inline tag; it must be enclosed in `{ }` braces.
*/
InlineTagMissingBraces = "tsdoc-inline-tag-missing-braces",
/**
* The TSDoc tag ___ is not an inline tag; it must not be enclosed in `{ }` braces.
*/
TagShouldNotHaveBraces = "tsdoc-tag-should-not-have-braces",
/**
* The TSDoc tag ___ is not supported by this tool.
*/
UnsupportedTag = "tsdoc-unsupported-tag",
/**
* The TSDoc tag ___ is not defined in this configuration.
*/
UndefinedTag = "tsdoc-undefined-tag",
/**
* The `@param` block should not include a JSDoc-style `{type}`.
*/
ParamTagWithInvalidType = "tsdoc-param-tag-with-invalid-type",
/**
* The `@param` block should not include a JSDoc-style optional name; it must not be enclosed in `[ ]` brackets.
*/
ParamTagWithInvalidOptionalName = "tsdoc-param-tag-with-invalid-optional-name",
/**
* The `@param` block should be followed by a parameter name.
*/
ParamTagWithInvalidName = "tsdoc-param-tag-with-invalid-name",
/**
* The `@param` block should be followed by a parameter name and then a hyphen.
*/
ParamTagMissingHyphen = "tsdoc-param-tag-missing-hyphen",
/**
* A backslash must precede another character that is being escaped. OR
* A backslash can only be used to escape a punctuation character.
*/
UnnecessaryBackslash = "tsdoc-unnecessary-backslash",
/**
* Expecting a TSDoc tag starting with `@`. OR
* Expecting a TSDoc tag starting with `{`.
*/
MissingTag = "tsdoc-missing-tag",
/**
* The `@` character looks like part of a TSDoc tag; use a backslash to escape it.
*/
AtSignInWord = "tsdoc-at-sign-in-word",
/**
* Expecting a TSDoc tag name after `@`; if it is not a tag, use a backslash to escape this character.
*/
AtSignWithoutTagName = "tsdoc-at-sign-without-tag-name",
/**
* Expecting a TSDoc tag starting with `{@`. OR
* Expecting a TSDoc inline tag name after the `{@` characters.
*/
MalformedInlineTag = "tsdoc-malformed-inline-tag",
/**
* The token ___ looks like a TSDoc tag but contains an invalid character ___; if it is not a tag,
* use a backslash to escape the `@`.
*/
CharactersAfterBlockTag = "tsdoc-characters-after-block-tag",
/**
* A TSDoc tag name must start with a letter and contain only letters and numbers.
*/
MalformedTagName = "tsdoc-malformed-tag-name",
/**
* The character ___ cannot appear after the TSDoc tag name; expecting a space.
*/
CharactersAfterInlineTag = "tsdoc-characters-after-inline-tag",
/**
* The TSDoc inline tag name is missing its closing `}`.
*/
InlineTagMissingRightBrace = "tsdoc-inline-tag-missing-right-brace",
/**
* The `{` character must be escaped with a backslash when used inside a TSDoc inline tag.
*/
InlineTagUnescapedBrace = "tsdoc-inline-tag-unescaped-brace",
/**
* Unexpected character after declaration reference.
*/
InheritDocTagSyntax = "tsdoc-inheritdoc-tag-syntax",
/**
* The `@link` tag content is missing.
*/
LinkTagEmpty = "tsdoc-link-tag-empty",
/**
* The ___ character may not be used in the link text without escaping it.
*/
LinkTagUnescapedText = "tsdoc-link-tag-unescaped-text",
/**
* Unexpected character after link destination.
*/
LinkTagDestinationSyntax = "tsdoc-link-tag-destination-syntax",
/**
* The URL cannot be empty. OR
* An `@link` URL must begin with a scheme comprised only of letters and numbers followed by `://`. OR
* An `@link` URL must have at least one character after `://`.
*/
LinkTagInvalidUrl = "tsdoc-link-tag-invalid-url",
/**
* The declaration reference appears to contain a package name or import path, but it is missing the `#` delimiter.
*/
ReferenceMissingHash = "tsdoc-reference-missing-hash",
/**
* The hash character must be preceded by a package name or import path.
*/
ReferenceHashSyntax = "tsdoc-reference-hash-syntax",
/**
* The package name cannot be an empty string. OR
* The package name ___ is not a valid package name.
*/
ReferenceMalformedPackageName = "tsdoc-reference-malformed-package-name",
/**
* An import path must not contain `//`. OR
* An import path must not end with `/`. OR
* An import path must not start with `/` unless prefixed by a package name.
*/
ReferenceMalformedImportPath = "tsdoc-reference-malformed-import-path",
/**
* Expecting a declaration reference.
*/
MissingReference = "tsdoc-missing-reference",
/**
* Expecting a period before the next component of a declaration reference
*/
ReferenceMissingDot = "tsdoc-reference-missing-dot",
/**
* Syntax error in declaration reference: the member selector must be enclosed in parentheses.
*/
ReferenceSelectorMissingParens = "tsdoc-reference-selector-missing-parens",
/**
* Expecting a colon after the identifier because the expression is in parentheses.
*/
ReferenceMissingColon = "tsdoc-reference-missing-colon",
/**
* Expecting a matching right parenthesis.
*/
ReferenceMissingRightParen = "tsdoc-reference-missing-right-paren",
/**
* Missing declaration reference in symbol reference
*/
ReferenceSymbolSyntax = "tsdoc-reference-symbol-syntax",
/**
* Missing closing square bracket for symbol reference
*/
ReferenceMissingRightBracket = "tsdoc-reference-missing-right-bracket",
/**
* Unexpected end of input inside quoted member identifier.
*/
ReferenceMissingQuote = "tsdoc-reference-missing-quote",
/**
* The quoted identifier cannot be empty.
*/
ReferenceEmptyIdentifier = "tsdoc-reference-empty-identifier",
/**
* Syntax error in declaration reference: expecting a member identifier.
*/
ReferenceMissingIdentifier = "tsdoc-reference-missing-identifier",
/**
* The identifier cannot be an empty string. OR
* The identifier cannot non-word characters. OR
* The identifier must not start with a number. OR
* The identifier ___ must be quoted because it is a TSDoc system selector name.
*/
ReferenceUnquotedIdentifier = "tsdoc-reference-unquoted-identifier",
/**
* Expecting a selector label after the colon.
*/
ReferenceMissingLabel = "tsdoc-reference-missing-label",
/**
* The selector cannot be an empty string. OR
* If the selector begins with a number, it must be a positive integer value. OR
* A label selector must be comprised of upper case letters, numbers, and underscores
* and must not start with a number. OR
* The selector ___ is not a recognized TSDoc system selector name.
*/
ReferenceSelectorSyntax = "tsdoc-reference-selector-syntax",
/**
* Expecting an attribute or `>` or `/>`.
*/
HtmlTagMissingGreaterThan = "tsdoc-html-tag-missing-greater-than",
/**
* Expecting `=` after HTML attribute name.
*/
HtmlTagMissingEquals = "tsdoc-html-tag-missing-equals",
/**
* Expecting an HTML string starting with a single-quote or double-quote character.
*/
HtmlTagMissingString = "tsdoc-html-tag-missing-string",
/**
* The HTML string is missing its closing quote.
*/
HtmlStringMissingQuote = "tsdoc-html-string-missing-quote",
/**
* The next character after a closing quote must be spacing or punctuation.
*/
TextAfterHtmlString = "tsdoc-text-after-html-string",
/**
* Expecting an HTML tag starting with `</`.
*/
MissingHtmlEndTag = "tsdoc-missing-html-end-tag",
/**
* A space is not allowed here. OR
* Expecting an HTML name. OR
* An HTML name must be a sequence of letters separated by hyphens.
*/
MalformedHtmlName = "tsdoc-malformed-html-name",
/**
* This HTML element name is not defined by your TSDoc configuration.
*/
UnsupportedHtmlElementName = "tsdoc-unsupported-html-name",
/**
* The opening backtick for a code fence must appear at the start of the line.
*/
CodeFenceOpeningIndent = "tsdoc-code-fence-opening-indent",
/**
* The language specifier cannot contain backtick characters.
*/
CodeFenceSpecifierSyntax = "tsdoc-code-fence-specifier-syntax",
/**
* The closing delimiter for a code fence must not be indented.
*/
CodeFenceClosingIndent = "tsdoc-code-fence-closing-indent",
/**
* Missing closing delimiter.
*/
CodeFenceMissingDelimiter = "tsdoc-code-fence-missing-delimiter",
/**
* Unexpected characters after closing delimiter for code fence.
*/
CodeFenceClosingSyntax = "tsdoc-code-fence-closing-syntax",
/**
* A code span must contain at least one character between the backticks.
*/
CodeSpanEmpty = "tsdoc-code-span-empty",
/**
* The code span is missing its closing backtick.
*/
CodeSpanMissingDelimiter = "tsdoc-code-span-missing-delimiter"
}
export declare const allTsdocMessageIds: string[];
export declare const allTsdocMessageIdsSet: ReadonlySet<string>;
//# sourceMappingURL=TSDocMessageId.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"TSDocMessageId.d.ts","sourceRoot":"","sources":["../../src/parser/TSDocMessageId.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,oBAAY,cAAc;IACxB;;;;OAIG;IACH,kBAAkB,gCAAgC;IAElD;;;;OAIG;IACH,iBAAiB,8BAA8B;IAE/C;;;;OAIG;IACH,2BAA2B,oCAAoC;IAE/D;;;;OAIG;IACH,qBAAqB,8BAA8B;IAEnD;;;;;OAKG;IACH,uBAAuB,gCAAgC;IAEvD;;;;OAIG;IACH,2BAA2B,oCAAoC;IAE/D;;;;OAIG;IACH,sBAAsB,+BAA+B;IAErD;;;;OAIG;IACH,0BAA0B,oCAAoC;IAE9D;;;;OAIG;IACH,wBAAwB,kCAAkC;IAE1D;;;OAGG;IACH,eAAe,4BAA4B;IAE3C;;OAEG;IACH,6BAA6B,4CAA4C;IAEzE;;OAEG;IACH,8BAA8B,4CAA4C;IAE1E;;OAEG;IACH,kBAAkB,+BAA+B;IAEjD;;OAEG;IACH,gBAAgB,6BAA6B;IAE7C;;OAEG;IACH,iBAAiB,8BAA8B;IAE/C;;OAEG;IACH,yBAAyB,sCAAsC;IAE/D;;OAEG;IACH,yBAAyB,sCAAsC;IAE/D;;OAEG;IACH,6BAA6B,0CAA0C;IAEvE;;OAEG;IACH,sBAAsB,oCAAoC;IAE1D;;OAEG;IACH,sBAAsB,qCAAqC;IAE3D;;OAEG;IACH,cAAc,0BAA0B;IAExC;;OAEG;IACH,YAAY,wBAAwB;IAEpC;;OAEG;IACH,uBAAuB,sCAAsC;IAE7D;;OAEG;IACH,+BAA+B,+CAA+C;IAE9E;;OAEG;IACH,uBAAuB,sCAAsC;IAE7D;;OAEG;IACH,qBAAqB,mCAAmC;IAExD;;;OAGG;IACH,oBAAoB,gCAAgC;IAEpD;;;OAGG;IACH,UAAU,sBAAsB;IAEhC;;OAEG;IACH,YAAY,0BAA0B;IAEtC;;OAEG;IACH,oBAAoB,mCAAmC;IAEvD;;;OAGG;IACH,kBAAkB,+BAA+B;IAEjD;;;OAGG;IACH,uBAAuB,qCAAqC;IAE5D;;OAEG;IACH,gBAAgB,6BAA6B;IAE7C;;OAEG;IACH,wBAAwB,sCAAsC;IAE9D;;OAEG;IACH,0BAA0B,yCAAyC;IAEnE;;OAEG;IACH,uBAAuB,qCAAqC;IAE5D;;OAEG;IACH,mBAAmB,gCAAgC;IAEnD;;OAEG;IACH,YAAY,yBAAyB;IAErC;;OAEG;IACH,oBAAoB,kCAAkC;IAEtD;;OAEG;IACH,wBAAwB,sCAAsC;IAE9D;;;;OAIG;IACH,iBAAiB,+BAA+B;IAEhD;;OAEG;IACH,oBAAoB,iCAAiC;IAErD;;OAEG;IACH,mBAAmB,gCAAgC;IAEnD;;;OAGG;IACH,6BAA6B,2CAA2C;IAExE;;;;OAIG;IACH,4BAA4B,0CAA0C;IAEtE;;OAEG;IACH,gBAAgB,4BAA4B;IAE5C;;OAEG;IACH,mBAAmB,gCAAgC;IAEnD;;OAEG;IACH,8BAA8B,4CAA4C;IAE1E;;OAEG;IACH,qBAAqB,kCAAkC;IAEvD;;OAEG;IACH,0BAA0B,wCAAwC;IAElE;;OAEG;IACH,qBAAqB,kCAAkC;IAEvD;;OAEG;IACH,4BAA4B,0CAA0C;IAEtE;;OAEG;IACH,qBAAqB,kCAAkC;IAEvD;;OAEG;IACH,wBAAwB,qCAAqC;IAE7D;;OAEG;IACH,0BAA0B,uCAAuC;IAEjE;;;;;OAKG;IACH,2BAA2B,wCAAwC;IAEnE;;OAEG;IACH,qBAAqB,kCAAkC;IAEvD;;;;;;OAMG;IACH,uBAAuB,oCAAoC;IAE3D;;OAEG;IACH,yBAAyB,wCAAwC;IAEjE;;OAEG;IACH,oBAAoB,kCAAkC;IAEtD;;OAEG;IACH,oBAAoB,kCAAkC;IAEtD;;OAEG;IACH,sBAAsB,oCAAoC;IAE1D;;OAEG;IACH,mBAAmB,iCAAiC;IAEpD;;OAEG;IACH,iBAAiB,+BAA+B;IAEhD;;;;OAIG;IACH,iBAAiB,8BAA8B;IAE/C;;OAEG;IACH,0BAA0B,gCAAgC;IAE1D;;OAEG;IACH,sBAAsB,oCAAoC;IAE1D;;OAEG;IACH,wBAAwB,sCAAsC;IAE9D;;OAEG;IACH,sBAAsB,oCAAoC;IAE1D;;OAEG;IACH,yBAAyB,uCAAuC;IAEhE;;OAEG;IACH,sBAAsB,oCAAoC;IAE1D;;OAEG;IACH,aAAa,0BAA0B;IAEvC;;OAEG;IACH,wBAAwB,sCAAsC;CAC/D;AAGD,eAAO,MAAM,kBAAkB,EAAE,MAAM,EA2EtC,CAAC;AAGF,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,MAAM,CAAuC,CAAC"}

View File

@@ -0,0 +1,425 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
/**
* Unique identifiers for messages reported by the TSDoc parser.
*
* @remarks
*
* These strings are possible values for the {@link ParserMessage.messageId} property.
* These identifiers can be used to suppress or configure the reporting of individual messages.
* They are also useful when searching for help about a particular error.
*
* @public
*/
export var TSDocMessageId;
(function (TSDocMessageId) {
/**
* File not found
* @remarks
* Reported by the `@microsoft/tsdoc-config` package when it failed to find a `tsdoc.json` file.
*/
TSDocMessageId["ConfigFileNotFound"] = "tsdoc-config-file-not-found";
/**
* Error parsing JSON input: ___
* @remarks
* Reported by the `@microsoft/tsdoc-config` package when the `tsdoc.json` file has invalid JSON syntax.
*/
TSDocMessageId["ConfigInvalidJson"] = "tsdoc-config-invalid-json";
/**
* Unsupported JSON "$schema" value
* @remarks
* Reported by the `@microsoft/tsdoc-config` package when the file format is not supported.
*/
TSDocMessageId["ConfigFileUnsupportedSchema"] = "tsdoc-config-unsupported-schema";
/**
* Error loading config file: ___
* @remarks
* Reported by the `@microsoft/tsdoc-config` package when the config file doesn't conform to its schema.
*/
TSDocMessageId["ConfigFileSchemaError"] = "tsdoc-config-schema-error";
/**
* Circular reference encountered for "extends" field of "___"
* @remarks
* Reported by the `@microsoft/tsdoc-config` package when the "extends" field creates a chain of references
* that causes a file to indirectly extend itself.
*/
TSDocMessageId["ConfigFileCyclicExtends"] = "tsdoc-config-cyclic-extends";
/**
* Unable to resolve "extends" reference to "___"
* @remarks
* Reported by the `@microsoft/tsdoc-config` package when module resolution fails for the "extends" field.
*/
TSDocMessageId["ConfigFileUnresolvedExtends"] = "tsdoc-config-unresolved-extends";
/**
* The "supportForTags" field refers to an undefined tag "___".
* @remarks
* Reported by the `@microsoft/tsdoc-config` package when loading the tsdoc.json config file.
*/
TSDocMessageId["ConfigFileUndefinedTag"] = "tsdoc-config-undefined-tag";
/**
* The "tagDefinitions" field specifies more than one tag with the name "___".
* @remarks
* Reported by the `@microsoft/tsdoc-config` package when loading the tsdoc.json config file.
*/
TSDocMessageId["ConfigFileDuplicateTagName"] = "tsdoc-config-duplicate-tag-name";
/**
* A TSDoc tag name must start with a letter and contain only letters and numbers.
* @remarks
* Reported by the `@microsoft/tsdoc-config` package when loading the tsdoc.json config file.
*/
TSDocMessageId["ConfigFileInvalidTagName"] = "tsdoc-config-invalid-tag-name";
/**
* Expecting a `/**` comment.
* Unexpected end of input.
*/
TSDocMessageId["CommentNotFound"] = "tsdoc-comment-not-found";
/**
* Expecting a leading `/**`
*/
TSDocMessageId["CommentOpeningDelimiterSyntax"] = "tsdoc-comment-missing-opening-delimiter";
/**
* Unexpected end of input.
*/
TSDocMessageId["CommentMissingClosingDelimiter"] = "tsdoc-comment-missing-closing-delimiter";
/**
* A doc comment cannot have more than one `@inheritDoc` tag
*/
TSDocMessageId["ExtraInheritDocTag"] = "tsdoc-extra-inheritdoc-tag";
/**
* The `}` character should be escaped using a backslash to avoid confusion with a TSDoc inline tag.
*/
TSDocMessageId["EscapeRightBrace"] = "tsdoc-escape-right-brace";
/**
* The `>` character should be escaped using a backslash to avoid confusion with an HTML tag.
*/
TSDocMessageId["EscapeGreaterThan"] = "tsdoc-escape-greater-than";
/**
* The ___ block must include a deprecation message, e.g. describing the recommended alternative.
*/
TSDocMessageId["MissingDeprecationMessage"] = "tsdoc-missing-deprecation-message";
/**
* A ___ block must not be used, because that content is provided by the `@inheritDoc` tag.
*/
TSDocMessageId["InheritDocIncompatibleTag"] = "tsdoc-inheritdoc-incompatible-tag";
/**
* The summary section must not have any content, because that content is provided by the `@inheritDoc` tag.
*/
TSDocMessageId["InheritDocIncompatibleSummary"] = "tsdoc-inheritdoc-incompatible-summary";
/**
* The TSDoc tag ___ is an inline tag; it must be enclosed in `{ }` braces.
*/
TSDocMessageId["InlineTagMissingBraces"] = "tsdoc-inline-tag-missing-braces";
/**
* The TSDoc tag ___ is not an inline tag; it must not be enclosed in `{ }` braces.
*/
TSDocMessageId["TagShouldNotHaveBraces"] = "tsdoc-tag-should-not-have-braces";
/**
* The TSDoc tag ___ is not supported by this tool.
*/
TSDocMessageId["UnsupportedTag"] = "tsdoc-unsupported-tag";
/**
* The TSDoc tag ___ is not defined in this configuration.
*/
TSDocMessageId["UndefinedTag"] = "tsdoc-undefined-tag";
/**
* The `@param` block should not include a JSDoc-style `{type}`.
*/
TSDocMessageId["ParamTagWithInvalidType"] = "tsdoc-param-tag-with-invalid-type";
/**
* The `@param` block should not include a JSDoc-style optional name; it must not be enclosed in `[ ]` brackets.
*/
TSDocMessageId["ParamTagWithInvalidOptionalName"] = "tsdoc-param-tag-with-invalid-optional-name";
/**
* The `@param` block should be followed by a parameter name.
*/
TSDocMessageId["ParamTagWithInvalidName"] = "tsdoc-param-tag-with-invalid-name";
/**
* The `@param` block should be followed by a parameter name and then a hyphen.
*/
TSDocMessageId["ParamTagMissingHyphen"] = "tsdoc-param-tag-missing-hyphen";
/**
* A backslash must precede another character that is being escaped. OR
* A backslash can only be used to escape a punctuation character.
*/
TSDocMessageId["UnnecessaryBackslash"] = "tsdoc-unnecessary-backslash";
/**
* Expecting a TSDoc tag starting with `@`. OR
* Expecting a TSDoc tag starting with `{`.
*/
TSDocMessageId["MissingTag"] = "tsdoc-missing-tag";
/**
* The `@` character looks like part of a TSDoc tag; use a backslash to escape it.
*/
TSDocMessageId["AtSignInWord"] = "tsdoc-at-sign-in-word";
/**
* Expecting a TSDoc tag name after `@`; if it is not a tag, use a backslash to escape this character.
*/
TSDocMessageId["AtSignWithoutTagName"] = "tsdoc-at-sign-without-tag-name";
/**
* Expecting a TSDoc tag starting with `{@`. OR
* Expecting a TSDoc inline tag name after the `{@` characters.
*/
TSDocMessageId["MalformedInlineTag"] = "tsdoc-malformed-inline-tag";
/**
* The token ___ looks like a TSDoc tag but contains an invalid character ___; if it is not a tag,
* use a backslash to escape the `@`.
*/
TSDocMessageId["CharactersAfterBlockTag"] = "tsdoc-characters-after-block-tag";
/**
* A TSDoc tag name must start with a letter and contain only letters and numbers.
*/
TSDocMessageId["MalformedTagName"] = "tsdoc-malformed-tag-name";
/**
* The character ___ cannot appear after the TSDoc tag name; expecting a space.
*/
TSDocMessageId["CharactersAfterInlineTag"] = "tsdoc-characters-after-inline-tag";
/**
* The TSDoc inline tag name is missing its closing `}`.
*/
TSDocMessageId["InlineTagMissingRightBrace"] = "tsdoc-inline-tag-missing-right-brace";
/**
* The `{` character must be escaped with a backslash when used inside a TSDoc inline tag.
*/
TSDocMessageId["InlineTagUnescapedBrace"] = "tsdoc-inline-tag-unescaped-brace";
/**
* Unexpected character after declaration reference.
*/
TSDocMessageId["InheritDocTagSyntax"] = "tsdoc-inheritdoc-tag-syntax";
/**
* The `@link` tag content is missing.
*/
TSDocMessageId["LinkTagEmpty"] = "tsdoc-link-tag-empty";
/**
* The ___ character may not be used in the link text without escaping it.
*/
TSDocMessageId["LinkTagUnescapedText"] = "tsdoc-link-tag-unescaped-text";
/**
* Unexpected character after link destination.
*/
TSDocMessageId["LinkTagDestinationSyntax"] = "tsdoc-link-tag-destination-syntax";
/**
* The URL cannot be empty. OR
* An `@link` URL must begin with a scheme comprised only of letters and numbers followed by `://`. OR
* An `@link` URL must have at least one character after `://`.
*/
TSDocMessageId["LinkTagInvalidUrl"] = "tsdoc-link-tag-invalid-url";
/**
* The declaration reference appears to contain a package name or import path, but it is missing the `#` delimiter.
*/
TSDocMessageId["ReferenceMissingHash"] = "tsdoc-reference-missing-hash";
/**
* The hash character must be preceded by a package name or import path.
*/
TSDocMessageId["ReferenceHashSyntax"] = "tsdoc-reference-hash-syntax";
/**
* The package name cannot be an empty string. OR
* The package name ___ is not a valid package name.
*/
TSDocMessageId["ReferenceMalformedPackageName"] = "tsdoc-reference-malformed-package-name";
/**
* An import path must not contain `//`. OR
* An import path must not end with `/`. OR
* An import path must not start with `/` unless prefixed by a package name.
*/
TSDocMessageId["ReferenceMalformedImportPath"] = "tsdoc-reference-malformed-import-path";
/**
* Expecting a declaration reference.
*/
TSDocMessageId["MissingReference"] = "tsdoc-missing-reference";
/**
* Expecting a period before the next component of a declaration reference
*/
TSDocMessageId["ReferenceMissingDot"] = "tsdoc-reference-missing-dot";
/**
* Syntax error in declaration reference: the member selector must be enclosed in parentheses.
*/
TSDocMessageId["ReferenceSelectorMissingParens"] = "tsdoc-reference-selector-missing-parens";
/**
* Expecting a colon after the identifier because the expression is in parentheses.
*/
TSDocMessageId["ReferenceMissingColon"] = "tsdoc-reference-missing-colon";
/**
* Expecting a matching right parenthesis.
*/
TSDocMessageId["ReferenceMissingRightParen"] = "tsdoc-reference-missing-right-paren";
/**
* Missing declaration reference in symbol reference
*/
TSDocMessageId["ReferenceSymbolSyntax"] = "tsdoc-reference-symbol-syntax";
/**
* Missing closing square bracket for symbol reference
*/
TSDocMessageId["ReferenceMissingRightBracket"] = "tsdoc-reference-missing-right-bracket";
/**
* Unexpected end of input inside quoted member identifier.
*/
TSDocMessageId["ReferenceMissingQuote"] = "tsdoc-reference-missing-quote";
/**
* The quoted identifier cannot be empty.
*/
TSDocMessageId["ReferenceEmptyIdentifier"] = "tsdoc-reference-empty-identifier";
/**
* Syntax error in declaration reference: expecting a member identifier.
*/
TSDocMessageId["ReferenceMissingIdentifier"] = "tsdoc-reference-missing-identifier";
/**
* The identifier cannot be an empty string. OR
* The identifier cannot non-word characters. OR
* The identifier must not start with a number. OR
* The identifier ___ must be quoted because it is a TSDoc system selector name.
*/
TSDocMessageId["ReferenceUnquotedIdentifier"] = "tsdoc-reference-unquoted-identifier";
/**
* Expecting a selector label after the colon.
*/
TSDocMessageId["ReferenceMissingLabel"] = "tsdoc-reference-missing-label";
/**
* The selector cannot be an empty string. OR
* If the selector begins with a number, it must be a positive integer value. OR
* A label selector must be comprised of upper case letters, numbers, and underscores
* and must not start with a number. OR
* The selector ___ is not a recognized TSDoc system selector name.
*/
TSDocMessageId["ReferenceSelectorSyntax"] = "tsdoc-reference-selector-syntax";
/**
* Expecting an attribute or `>` or `/>`.
*/
TSDocMessageId["HtmlTagMissingGreaterThan"] = "tsdoc-html-tag-missing-greater-than";
/**
* Expecting `=` after HTML attribute name.
*/
TSDocMessageId["HtmlTagMissingEquals"] = "tsdoc-html-tag-missing-equals";
/**
* Expecting an HTML string starting with a single-quote or double-quote character.
*/
TSDocMessageId["HtmlTagMissingString"] = "tsdoc-html-tag-missing-string";
/**
* The HTML string is missing its closing quote.
*/
TSDocMessageId["HtmlStringMissingQuote"] = "tsdoc-html-string-missing-quote";
/**
* The next character after a closing quote must be spacing or punctuation.
*/
TSDocMessageId["TextAfterHtmlString"] = "tsdoc-text-after-html-string";
/**
* Expecting an HTML tag starting with `</`.
*/
TSDocMessageId["MissingHtmlEndTag"] = "tsdoc-missing-html-end-tag";
/**
* A space is not allowed here. OR
* Expecting an HTML name. OR
* An HTML name must be a sequence of letters separated by hyphens.
*/
TSDocMessageId["MalformedHtmlName"] = "tsdoc-malformed-html-name";
/**
* This HTML element name is not defined by your TSDoc configuration.
*/
TSDocMessageId["UnsupportedHtmlElementName"] = "tsdoc-unsupported-html-name";
/**
* The opening backtick for a code fence must appear at the start of the line.
*/
TSDocMessageId["CodeFenceOpeningIndent"] = "tsdoc-code-fence-opening-indent";
/**
* The language specifier cannot contain backtick characters.
*/
TSDocMessageId["CodeFenceSpecifierSyntax"] = "tsdoc-code-fence-specifier-syntax";
/**
* The closing delimiter for a code fence must not be indented.
*/
TSDocMessageId["CodeFenceClosingIndent"] = "tsdoc-code-fence-closing-indent";
/**
* Missing closing delimiter.
*/
TSDocMessageId["CodeFenceMissingDelimiter"] = "tsdoc-code-fence-missing-delimiter";
/**
* Unexpected characters after closing delimiter for code fence.
*/
TSDocMessageId["CodeFenceClosingSyntax"] = "tsdoc-code-fence-closing-syntax";
/**
* A code span must contain at least one character between the backticks.
*/
TSDocMessageId["CodeSpanEmpty"] = "tsdoc-code-span-empty";
/**
* The code span is missing its closing backtick.
*/
TSDocMessageId["CodeSpanMissingDelimiter"] = "tsdoc-code-span-missing-delimiter";
})(TSDocMessageId || (TSDocMessageId = {}));
// Exposed via TSDocConfiguration.allTsdocMessageIds()
export const allTsdocMessageIds = [
// To make comparisons easy, keep these in the same order as the enum above:
'tsdoc-config-file-not-found',
'tsdoc-config-invalid-json',
'tsdoc-config-unsupported-schema',
'tsdoc-config-schema-error',
'tsdoc-config-cyclic-extends',
'tsdoc-config-unresolved-extends',
'tsdoc-config-undefined-tag',
'tsdoc-config-duplicate-tag-name',
'tsdoc-config-invalid-tag-name',
'tsdoc-comment-not-found',
'tsdoc-comment-missing-opening-delimiter',
'tsdoc-comment-missing-closing-delimiter',
'tsdoc-extra-inheritdoc-tag',
'tsdoc-escape-right-brace',
'tsdoc-escape-greater-than',
'tsdoc-missing-deprecation-message',
'tsdoc-inheritdoc-incompatible-tag',
'tsdoc-inheritdoc-incompatible-summary',
'tsdoc-inline-tag-missing-braces',
'tsdoc-tag-should-not-have-braces',
'tsdoc-unsupported-tag',
'tsdoc-undefined-tag',
'tsdoc-param-tag-with-invalid-type',
'tsdoc-param-tag-with-invalid-optional-name',
'tsdoc-param-tag-with-invalid-name',
'tsdoc-param-tag-missing-hyphen',
'tsdoc-unnecessary-backslash',
'tsdoc-missing-tag',
'tsdoc-at-sign-in-word',
'tsdoc-at-sign-without-tag-name',
'tsdoc-malformed-inline-tag',
'tsdoc-characters-after-block-tag',
'tsdoc-malformed-tag-name',
'tsdoc-characters-after-inline-tag',
'tsdoc-inline-tag-missing-right-brace',
'tsdoc-inline-tag-unescaped-brace',
'tsdoc-inheritdoc-tag-syntax',
'tsdoc-link-tag-empty',
'tsdoc-link-tag-unescaped-text',
'tsdoc-link-tag-destination-syntax',
'tsdoc-link-tag-invalid-url',
'tsdoc-reference-missing-hash',
'tsdoc-reference-hash-syntax',
'tsdoc-reference-malformed-package-name',
'tsdoc-reference-malformed-import-path',
'tsdoc-missing-reference',
'tsdoc-reference-missing-dot',
'tsdoc-reference-selector-missing-parens',
'tsdoc-reference-missing-colon',
'tsdoc-reference-missing-right-paren',
'tsdoc-reference-symbol-syntax',
'tsdoc-reference-missing-right-bracket',
'tsdoc-reference-missing-quote',
'tsdoc-reference-empty-identifier',
'tsdoc-reference-missing-identifier',
'tsdoc-reference-unquoted-identifier',
'tsdoc-reference-missing-label',
'tsdoc-reference-selector-syntax',
'tsdoc-html-tag-missing-greater-than',
'tsdoc-html-tag-missing-equals',
'tsdoc-html-tag-missing-string',
'tsdoc-html-string-missing-quote',
'tsdoc-text-after-html-string',
'tsdoc-missing-html-end-tag',
'tsdoc-malformed-html-name',
'tsdoc-code-fence-opening-indent',
'tsdoc-code-fence-specifier-syntax',
'tsdoc-code-fence-closing-indent',
'tsdoc-code-fence-missing-delimiter',
'tsdoc-code-fence-closing-syntax',
'tsdoc-code-span-empty',
'tsdoc-code-span-missing-delimiter'
];
allTsdocMessageIds.sort();
export const allTsdocMessageIdsSet = new Set(allTsdocMessageIds);
//# sourceMappingURL=TSDocMessageId.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,16 @@
import { TextRange } from './TextRange';
import { ParserContext } from './ParserContext';
import { TSDocConfiguration } from '../configuration/TSDocConfiguration';
/**
* The main API for parsing TSDoc comments.
*/
export declare class TSDocParser {
/**
* The configuration that was provided for the TSDocParser.
*/
readonly configuration: TSDocConfiguration;
constructor(configuration?: TSDocConfiguration);
parseString(text: string): ParserContext;
parseRange(range: TextRange): ParserContext;
}
//# sourceMappingURL=TSDocParser.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"TSDocParser.d.ts","sourceRoot":"","sources":["../../src/parser/TSDocParser.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAGzE;;GAEG;AACH,qBAAa,WAAW;IACtB;;OAEG;IACH,SAAgB,aAAa,EAAE,kBAAkB,CAAC;gBAE/B,aAAa,CAAC,EAAE,kBAAkB;IAQ9C,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa;IAIxC,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,aAAa;CAcnD"}

View File

@@ -0,0 +1,36 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
import { TextRange } from './TextRange';
import { ParserContext } from './ParserContext';
import { LineExtractor } from './LineExtractor';
import { Tokenizer } from './Tokenizer';
import { NodeParser } from './NodeParser';
import { TSDocConfiguration } from '../configuration/TSDocConfiguration';
import { ParagraphSplitter } from './ParagraphSplitter';
/**
* The main API for parsing TSDoc comments.
*/
export class TSDocParser {
constructor(configuration) {
if (configuration) {
this.configuration = configuration;
}
else {
this.configuration = new TSDocConfiguration();
}
}
parseString(text) {
return this.parseRange(TextRange.fromString(text));
}
parseRange(range) {
const parserContext = new ParserContext(this.configuration, range);
if (LineExtractor.extract(parserContext)) {
parserContext.tokens = Tokenizer.readTokens(parserContext.lines);
const nodeParser = new NodeParser(parserContext);
nodeParser.parse();
ParagraphSplitter.splitParagraphs(parserContext.docComment);
}
return parserContext;
}
}
//# sourceMappingURL=TSDocParser.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"TSDocParser.js","sourceRoot":"","sources":["../../src/parser/TSDocParser.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD;;GAEG;AACH,MAAM,OAAO,WAAW;IAMtB,YAAmB,aAAkC;QACnD,IAAI,aAAa,EAAE,CAAC;YAClB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACrC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,aAAa,GAAG,IAAI,kBAAkB,EAAE,CAAC;QAChD,CAAC;IACH,CAAC;IAEM,WAAW,CAAC,IAAY;QAC7B,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IACrD,CAAC;IAEM,UAAU,CAAC,KAAgB;QAChC,MAAM,aAAa,GAAkB,IAAI,aAAa,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;QAElF,IAAI,aAAa,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;YACzC,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YAEjE,MAAM,UAAU,GAAe,IAAI,UAAU,CAAC,aAAa,CAAC,CAAC;YAC7D,UAAU,CAAC,KAAK,EAAE,CAAC;YAEnB,iBAAiB,CAAC,eAAe,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAC9D,CAAC;QAED,OAAO,aAAa,CAAC;IACvB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport { TextRange } from './TextRange';\r\nimport { ParserContext } from './ParserContext';\r\nimport { LineExtractor } from './LineExtractor';\r\nimport { Tokenizer } from './Tokenizer';\r\nimport { NodeParser } from './NodeParser';\r\nimport { TSDocConfiguration } from '../configuration/TSDocConfiguration';\r\nimport { ParagraphSplitter } from './ParagraphSplitter';\r\n\r\n/**\r\n * The main API for parsing TSDoc comments.\r\n */\r\nexport class TSDocParser {\r\n /**\r\n * The configuration that was provided for the TSDocParser.\r\n */\r\n public readonly configuration: TSDocConfiguration;\r\n\r\n public constructor(configuration?: TSDocConfiguration) {\r\n if (configuration) {\r\n this.configuration = configuration;\r\n } else {\r\n this.configuration = new TSDocConfiguration();\r\n }\r\n }\r\n\r\n public parseString(text: string): ParserContext {\r\n return this.parseRange(TextRange.fromString(text));\r\n }\r\n\r\n public parseRange(range: TextRange): ParserContext {\r\n const parserContext: ParserContext = new ParserContext(this.configuration, range);\r\n\r\n if (LineExtractor.extract(parserContext)) {\r\n parserContext.tokens = Tokenizer.readTokens(parserContext.lines);\r\n\r\n const nodeParser: NodeParser = new NodeParser(parserContext);\r\n nodeParser.parse();\r\n\r\n ParagraphSplitter.splitParagraphs(parserContext.docComment);\r\n }\r\n\r\n return parserContext;\r\n }\r\n}\r\n"]}

View File

@@ -0,0 +1,86 @@
/**
* Text coordinates represented as a line number and column number.
*
* @remarks
* The first character in a file is considered to be in column 1 of line 1.
* The location with column 0 and line 0 is used to represent an empty, unspecified,
* or unknown location.
*/
export interface ITextLocation {
line: number;
column: number;
}
/**
* Efficiently references a range of text from a string buffer.
*/
export declare class TextRange {
/**
* Used to represent an empty or unknown range.
*/
static readonly empty: TextRange;
/**
* The starting index into the associated text buffer.
*
* @remarks
* The text range corresponds to the `range.buffer.substring(range.pos, range.end)`.
*/
readonly pos: number;
/**
* The (non-inclusive) ending index for the associated text buffer.
*
* @remarks
* The text range corresponds to the `range.buffer.substring(range.pos, range.end)`.
*/
readonly end: number;
/**
* The string buffer that the `pos` and `end` indexes refer to.
*/
readonly buffer: string;
private constructor();
/**
* Constructs a TextRange that corresponds to an entire string object.
*/
static fromString(buffer: string): TextRange;
/**
* Constructs a TextRange that corresponds to an entire string object.
*/
static fromStringRange(buffer: string, pos: number, end: number): TextRange;
/**
* Returns the length of the text range.
* @remarks
* This value is calculated as the `end` property minus the `pos` property.
*/
get length(): number;
/**
* Constructs a TextRange that corresponds to a different range of an existing buffer.
*/
getNewRange(pos: number, end: number): TextRange;
/**
* Returns true if the length of the range is zero. Note that the object reference may not
* be equal to `TextRange.empty`, and the buffer may be different.
*/
isEmpty(): boolean;
/**
* Returns the range from the associated string buffer.
*/
toString(): string;
/**
* Returns a debugging dump of the range, indicated via custom delimiters.
* @remarks
* For example if the delimiters are "[" and "]", and the range is 3..5 inside "1234567",
* then the output would be "12[345]67".
*/
getDebugDump(posDelimiter: string, endDelimiter: string): string;
/**
* Calculates the line and column number for the specified offset into the buffer.
*
* @remarks
* This is a potentially expensive operation.
*
* @param index - an integer offset
* @param buffer - the buffer
*/
getLocation(index: number): ITextLocation;
private _validateBounds;
}
//# sourceMappingURL=TextRange.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"TextRange.d.ts","sourceRoot":"","sources":["../../src/parser/TextRange.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,qBAAa,SAAS;IACpB;;OAEG;IACH,gBAAuB,KAAK,EAAE,SAAS,CAA2B;IAElE;;;;;OAKG;IACH,SAAgB,GAAG,EAAE,MAAM,CAAC;IAE5B;;;;;OAKG;IACH,SAAgB,GAAG,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,SAAgB,MAAM,EAAE,MAAM,CAAC;IAE/B,OAAO;IAOP;;OAEG;WACW,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS;IAInD;;OAEG;WACW,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS;IAIlF;;;;OAIG;IACH,IAAW,MAAM,IAAI,MAAM,CAE1B;IAED;;OAEG;IACI,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS;IAIvD;;;OAGG;IACI,OAAO,IAAI,OAAO;IAIzB;;OAEG;IACI,QAAQ,IAAI,MAAM;IAIzB;;;;;OAKG;IACI,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM;IAUvE;;;;;;;;OAQG;IACI,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa;IAoChD,OAAO,CAAC,eAAe;CAiBxB"}

126
node_modules/@microsoft/tsdoc/lib/parser/TextRange.js generated vendored Normal file
View File

@@ -0,0 +1,126 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
/**
* Efficiently references a range of text from a string buffer.
*/
export class TextRange {
constructor(buffer, pos, end) {
this.buffer = buffer;
this.pos = pos;
this.end = end;
this._validateBounds();
}
/**
* Constructs a TextRange that corresponds to an entire string object.
*/
static fromString(buffer) {
return new TextRange(buffer, 0, buffer.length);
}
/**
* Constructs a TextRange that corresponds to an entire string object.
*/
static fromStringRange(buffer, pos, end) {
return new TextRange(buffer, pos, end);
}
/**
* Returns the length of the text range.
* @remarks
* This value is calculated as the `end` property minus the `pos` property.
*/
get length() {
return this.end - this.pos;
}
/**
* Constructs a TextRange that corresponds to a different range of an existing buffer.
*/
getNewRange(pos, end) {
return new TextRange(this.buffer, pos, end);
}
/**
* Returns true if the length of the range is zero. Note that the object reference may not
* be equal to `TextRange.empty`, and the buffer may be different.
*/
isEmpty() {
return this.pos === this.end;
}
/**
* Returns the range from the associated string buffer.
*/
toString() {
return this.buffer.substring(this.pos, this.end);
}
/**
* Returns a debugging dump of the range, indicated via custom delimiters.
* @remarks
* For example if the delimiters are "[" and "]", and the range is 3..5 inside "1234567",
* then the output would be "12[345]67".
*/
getDebugDump(posDelimiter, endDelimiter) {
return (this.buffer.substring(0, this.pos) +
posDelimiter +
this.buffer.substring(this.pos, this.end) +
endDelimiter +
this.buffer.substring(this.end));
}
/**
* Calculates the line and column number for the specified offset into the buffer.
*
* @remarks
* This is a potentially expensive operation.
*
* @param index - an integer offset
* @param buffer - the buffer
*/
getLocation(index) {
if (index < 0 || index > this.buffer.length) {
// No match
return { line: 0, column: 0 };
}
// TODO: Consider caching or optimizing this somehow
let line = 1;
let column = 1;
let currentIndex = 0;
while (currentIndex < index) {
const current = this.buffer[currentIndex];
++currentIndex;
if (current === '\r') {
// CR
// Ignore '\r' and assume it will always have an accompanying '\n'
continue;
}
if (current === '\n') {
// LF
++line;
column = 1;
}
else {
// NOTE: For consistency with the TypeScript compiler, a tab character is assumed
// to advance by one column
++column;
}
}
return { line, column };
}
_validateBounds() {
if (this.pos < 0) {
throw new Error('TextRange.pos cannot be negative');
}
if (this.end < 0) {
throw new Error('TextRange.end cannot be negative');
}
if (this.end < this.pos) {
throw new Error('TextRange.end cannot be smaller than TextRange.pos');
}
if (this.pos > this.buffer.length) {
throw new Error('TextRange.pos cannot exceed the associated text buffer length');
}
if (this.end > this.buffer.length) {
throw new Error('TextRange.end cannot exceed the associated text buffer length');
}
}
}
/**
* Used to represent an empty or unknown range.
*/
TextRange.empty = new TextRange('', 0, 0);
//# sourceMappingURL=TextRange.js.map

File diff suppressed because one or more lines are too long

172
node_modules/@microsoft/tsdoc/lib/parser/Token.d.ts generated vendored Normal file
View File

@@ -0,0 +1,172 @@
import type { TextRange } from './TextRange';
/**
* Distinguishes different types of Token objects.
*/
export declare enum TokenKind {
/**
* A token representing the end of the input. The Token.range will be an empty range
* at the end of the provided input.
*/
EndOfInput = 2001,
/**
* A token representing a virtual newline.
* The Token.range will be an empty range, because the actual newline character may
* be noncontiguous due to the doc comment delimiter trimming.
*/
Newline = 2002,
/**
* A token representing one or more spaces and tabs (but not newlines or end of input).
*/
Spacing = 2003,
/**
* A token representing one or more ASCII letters, numbers, and underscores.
*/
AsciiWord = 2004,
/**
* A single ASCII character that behaves like punctuation, e.g. doesn't need whitespace
* around it when adjacent to a letter. The Token.range will always be a string of length 1.
*/
OtherPunctuation = 2005,
/**
* A token representing a sequence of non-ASCII printable characters that are not punctuation.
*/
Other = 2006,
/**
* The backslash character `\`.
* The Token.range will always be a string of length 1.
*/
Backslash = 2007,
/**
* The less-than character `<`.
* The Token.range will always be a string of length 1.
*/
LessThan = 2008,
/**
* The greater-than character `>`.
* The Token.range will always be a string of length 1.
*/
GreaterThan = 2009,
/**
* The equals character `=`.
* The Token.range will always be a string of length 1.
*/
Equals = 2010,
/**
* The single-quote character `'`.
* The Token.range will always be a string of length 1.
*/
SingleQuote = 2011,
/**
* The double-quote character `"`.
* The Token.range will always be a string of length 1.
*/
DoubleQuote = 2012,
/**
* The slash character `/`.
* The Token.range will always be a string of length 1.
*/
Slash = 2013,
/**
* The hyphen character `-`.
* The Token.range will always be a string of length 1.
*/
Hyphen = 2014,
/**
* The at-sign character `@`.
* The Token.range will always be a string of length 1.
*/
AtSign = 2015,
/**
* The left curly bracket character `{`.
* The Token.range will always be a string of length 1.
*/
LeftCurlyBracket = 2016,
/**
* The right curly bracket character `}`.
* The Token.range will always be a string of length 1.
*/
RightCurlyBracket = 2017,
/**
* The backtick character.
* The Token.range will always be a string of length 1.
*/
Backtick = 2018,
/**
* The period character.
* The Token.range will always be a string of length 1.
*/
Period = 2019,
/**
* The colon character.
* The Token.range will always be a string of length 1.
*/
Colon = 2020,
/**
* The comma character.
* The Token.range will always be a string of length 1.
*/
Comma = 2021,
/**
* The left square bracket character.
* The Token.range will always be a string of length 1.
*/
LeftSquareBracket = 2022,
/**
* The right square bracket character.
* The Token.range will always be a string of length 1.
*/
RightSquareBracket = 2023,
/**
* The pipe character `|`.
* The Token.range will always be a string of length 1.
*/
Pipe = 2024,
/**
* The left parenthesis character.
* The Token.range will always be a string of length 1.
*/
LeftParenthesis = 2025,
/**
* The right parenthesis character.
* The Token.range will always be a string of length 1.
*/
RightParenthesis = 2026,
/**
* The pound character ("#").
* The Token.range will always be a string of length 1.
*/
PoundSymbol = 2027,
/**
* The plus character ("+").
* The Token.range will always be a string of length 1.
*/
Plus = 2028,
/**
* The dollar sign character ("$").
* The Token.range will always be a string of length 1.
*/
DollarSign = 2029
}
/**
* Represents a contiguous range of characters extracted from one of the doc comment lines
* being processed by the Tokenizer. There is a token representing a newline, but otherwise
* a single token cannot span multiple lines.
*/
export declare class Token {
/**
* The kind of token
*/
readonly kind: TokenKind;
/**
* The contiguous input range corresponding to the token. This range will never
* contain a newline character.
*/
readonly range: TextRange;
/**
* The doc comment "line" that this Token was extracted from.
*/
readonly line: TextRange;
constructor(kind: TokenKind, range: TextRange, line: TextRange);
toString(): string;
}
//# sourceMappingURL=Token.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Token.d.ts","sourceRoot":"","sources":["../../src/parser/Token.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,oBAAY,SAAS;IACnB;;;OAGG;IACH,UAAU,OAAO;IAEjB;;;;OAIG;IACH,OAAO,OAAO;IAEd;;OAEG;IACH,OAAO,OAAO;IAEd;;OAEG;IACH,SAAS,OAAO;IAEhB;;;OAGG;IACH,gBAAgB,OAAO;IAEvB;;OAEG;IACH,KAAK,OAAO;IAEZ;;;OAGG;IACH,SAAS,OAAO;IAEhB;;;OAGG;IACH,QAAQ,OAAO;IAEf;;;OAGG;IACH,WAAW,OAAO;IAElB;;;OAGG;IACH,MAAM,OAAO;IAEb;;;OAGG;IACH,WAAW,OAAO;IAElB;;;OAGG;IACH,WAAW,OAAO;IAElB;;;OAGG;IACH,KAAK,OAAO;IAEZ;;;OAGG;IACH,MAAM,OAAO;IAEb;;;OAGG;IACH,MAAM,OAAO;IAEb;;;OAGG;IACH,gBAAgB,OAAO;IAEvB;;;OAGG;IACH,iBAAiB,OAAO;IAExB;;;OAGG;IACH,QAAQ,OAAO;IAEf;;;OAGG;IACH,MAAM,OAAO;IAEb;;;OAGG;IACH,KAAK,OAAO;IAEZ;;;OAGG;IACH,KAAK,OAAO;IAEZ;;;OAGG;IACH,iBAAiB,OAAO;IAExB;;;OAGG;IACH,kBAAkB,OAAO;IAEzB;;;OAGG;IACH,IAAI,OAAO;IAEX;;;OAGG;IACH,eAAe,OAAO;IAEtB;;;OAGG;IACH,gBAAgB,OAAO;IAEvB;;;OAGG;IACH,WAAW,OAAO;IAElB;;;OAGG;IACH,IAAI,OAAO;IAEX;;;OAGG;IACH,UAAU,OAAO;CAClB;AAED;;;;GAIG;AACH,qBAAa,KAAK;IAChB;;OAEG;IACH,SAAgB,IAAI,EAAE,SAAS,CAAC;IAChC;;;OAGG;IACH,SAAgB,KAAK,EAAE,SAAS,CAAC;IAEjC;;OAEG;IACH,SAAgB,IAAI,EAAE,SAAS,CAAC;gBAEb,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS;IAM9D,QAAQ,IAAI,MAAM;CAM1B"}

170
node_modules/@microsoft/tsdoc/lib/parser/Token.js generated vendored Normal file
View File

@@ -0,0 +1,170 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
/**
* Distinguishes different types of Token objects.
*/
export var TokenKind;
(function (TokenKind) {
/**
* A token representing the end of the input. The Token.range will be an empty range
* at the end of the provided input.
*/
TokenKind[TokenKind["EndOfInput"] = 2001] = "EndOfInput";
/**
* A token representing a virtual newline.
* The Token.range will be an empty range, because the actual newline character may
* be noncontiguous due to the doc comment delimiter trimming.
*/
TokenKind[TokenKind["Newline"] = 2002] = "Newline";
/**
* A token representing one or more spaces and tabs (but not newlines or end of input).
*/
TokenKind[TokenKind["Spacing"] = 2003] = "Spacing";
/**
* A token representing one or more ASCII letters, numbers, and underscores.
*/
TokenKind[TokenKind["AsciiWord"] = 2004] = "AsciiWord";
/**
* A single ASCII character that behaves like punctuation, e.g. doesn't need whitespace
* around it when adjacent to a letter. The Token.range will always be a string of length 1.
*/
TokenKind[TokenKind["OtherPunctuation"] = 2005] = "OtherPunctuation";
/**
* A token representing a sequence of non-ASCII printable characters that are not punctuation.
*/
TokenKind[TokenKind["Other"] = 2006] = "Other";
/**
* The backslash character `\`.
* The Token.range will always be a string of length 1.
*/
TokenKind[TokenKind["Backslash"] = 2007] = "Backslash";
/**
* The less-than character `<`.
* The Token.range will always be a string of length 1.
*/
TokenKind[TokenKind["LessThan"] = 2008] = "LessThan";
/**
* The greater-than character `>`.
* The Token.range will always be a string of length 1.
*/
TokenKind[TokenKind["GreaterThan"] = 2009] = "GreaterThan";
/**
* The equals character `=`.
* The Token.range will always be a string of length 1.
*/
TokenKind[TokenKind["Equals"] = 2010] = "Equals";
/**
* The single-quote character `'`.
* The Token.range will always be a string of length 1.
*/
TokenKind[TokenKind["SingleQuote"] = 2011] = "SingleQuote";
/**
* The double-quote character `"`.
* The Token.range will always be a string of length 1.
*/
TokenKind[TokenKind["DoubleQuote"] = 2012] = "DoubleQuote";
/**
* The slash character `/`.
* The Token.range will always be a string of length 1.
*/
TokenKind[TokenKind["Slash"] = 2013] = "Slash";
/**
* The hyphen character `-`.
* The Token.range will always be a string of length 1.
*/
TokenKind[TokenKind["Hyphen"] = 2014] = "Hyphen";
/**
* The at-sign character `@`.
* The Token.range will always be a string of length 1.
*/
TokenKind[TokenKind["AtSign"] = 2015] = "AtSign";
/**
* The left curly bracket character `{`.
* The Token.range will always be a string of length 1.
*/
TokenKind[TokenKind["LeftCurlyBracket"] = 2016] = "LeftCurlyBracket";
/**
* The right curly bracket character `}`.
* The Token.range will always be a string of length 1.
*/
TokenKind[TokenKind["RightCurlyBracket"] = 2017] = "RightCurlyBracket";
/**
* The backtick character.
* The Token.range will always be a string of length 1.
*/
TokenKind[TokenKind["Backtick"] = 2018] = "Backtick";
/**
* The period character.
* The Token.range will always be a string of length 1.
*/
TokenKind[TokenKind["Period"] = 2019] = "Period";
/**
* The colon character.
* The Token.range will always be a string of length 1.
*/
TokenKind[TokenKind["Colon"] = 2020] = "Colon";
/**
* The comma character.
* The Token.range will always be a string of length 1.
*/
TokenKind[TokenKind["Comma"] = 2021] = "Comma";
/**
* The left square bracket character.
* The Token.range will always be a string of length 1.
*/
TokenKind[TokenKind["LeftSquareBracket"] = 2022] = "LeftSquareBracket";
/**
* The right square bracket character.
* The Token.range will always be a string of length 1.
*/
TokenKind[TokenKind["RightSquareBracket"] = 2023] = "RightSquareBracket";
/**
* The pipe character `|`.
* The Token.range will always be a string of length 1.
*/
TokenKind[TokenKind["Pipe"] = 2024] = "Pipe";
/**
* The left parenthesis character.
* The Token.range will always be a string of length 1.
*/
TokenKind[TokenKind["LeftParenthesis"] = 2025] = "LeftParenthesis";
/**
* The right parenthesis character.
* The Token.range will always be a string of length 1.
*/
TokenKind[TokenKind["RightParenthesis"] = 2026] = "RightParenthesis";
/**
* The pound character ("#").
* The Token.range will always be a string of length 1.
*/
TokenKind[TokenKind["PoundSymbol"] = 2027] = "PoundSymbol";
/**
* The plus character ("+").
* The Token.range will always be a string of length 1.
*/
TokenKind[TokenKind["Plus"] = 2028] = "Plus";
/**
* The dollar sign character ("$").
* The Token.range will always be a string of length 1.
*/
TokenKind[TokenKind["DollarSign"] = 2029] = "DollarSign";
})(TokenKind || (TokenKind = {}));
/**
* Represents a contiguous range of characters extracted from one of the doc comment lines
* being processed by the Tokenizer. There is a token representing a newline, but otherwise
* a single token cannot span multiple lines.
*/
export class Token {
constructor(kind, range, line) {
this.kind = kind;
this.range = range;
this.line = line;
}
toString() {
if (this.kind === TokenKind.Newline) {
return '\n';
}
return this.range.toString();
}
}
//# sourceMappingURL=Token.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,81 @@
import { type Token, TokenKind } from './Token';
import { TokenSequence } from './TokenSequence';
import type { ParserContext } from './ParserContext';
/**
* Manages a stream of tokens that are read by the parser.
*
* @remarks
* Use TokenReader.readToken() to read a token and advance the stream pointer.
* Use TokenReader.peekToken() to preview the next token.
* Use TokenReader.createMarker() and backtrackToMarker() to rewind to an earlier point.
* Whenever readToken() is called, the token is added to an accumulated TokenSequence
* that can be extracted by calling extractAccumulatedSequence().
*/
export declare class TokenReader {
readonly tokens: ReadonlyArray<Token>;
private readonly _parserContext;
private _readerStartIndex;
private _readerEndIndex;
private _currentIndex;
private _accumulatedStartIndex;
constructor(parserContext: ParserContext, embeddedTokenSequence?: TokenSequence);
/**
* Extracts and returns the TokenSequence that was accumulated so far by calls to readToken().
* The next call to readToken() will start a new accumulated sequence.
*/
extractAccumulatedSequence(): TokenSequence;
/**
* Returns true if the accumulated sequence has any tokens yet. This will be false
* when the TokenReader starts, and it will be false immediately after a call
* to extractAccumulatedSequence(). Otherwise, it will become true whenever readToken()
* is called.
*/
isAccumulatedSequenceEmpty(): boolean;
/**
* Like extractAccumulatedSequence(), but returns undefined if nothing has been
* accumulated yet.
*/
tryExtractAccumulatedSequence(): TokenSequence | undefined;
/**
* Asserts that isAccumulatedSequenceEmpty() should return false. If not, an exception
* is throw indicating a parser bug.
*/
assertAccumulatedSequenceIsEmpty(): void;
/**
* Returns the next token that would be returned by _readToken(), without
* consuming anything.
*/
peekToken(): Token;
/**
* Returns the TokenKind for the next token that would be returned by _readToken(), without
* consuming anything.
*/
peekTokenKind(): TokenKind;
/**
* Like peekTokenKind(), but looks ahead two tokens.
*/
peekTokenAfterKind(): TokenKind;
/**
* Like peekTokenKind(), but looks ahead three tokens.
*/
peekTokenAfterAfterKind(): TokenKind;
/**
* Extract the next token from the input stream and return it.
* The token will also be appended to the accumulated sequence, which can
* later be accessed via extractAccumulatedSequence().
*/
readToken(): Token;
/**
* Returns the kind of the token immediately before the current token.
*/
peekPreviousTokenKind(): TokenKind;
/**
* Remembers the current position in the stream.
*/
createMarker(): number;
/**
* Rewinds the stream pointer to a previous position in the stream.
*/
backtrackToMarker(marker: number): void;
}
//# sourceMappingURL=TokenReader.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"TokenReader.d.ts","sourceRoot":"","sources":["../../src/parser/TokenReader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;;;;;GASG;AACH,qBAAa,WAAW;IACtB,SAAgB,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;IAE7C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAgB;IAI/C,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,eAAe,CAAS;IAGhC,OAAO,CAAC,aAAa,CAAS;IAG9B,OAAO,CAAC,sBAAsB,CAAS;gBAEpB,aAAa,EAAE,aAAa,EAAE,qBAAqB,CAAC,EAAE,aAAa;IAmBtF;;;OAGG;IACI,0BAA0B,IAAI,aAAa;IAoBlD;;;;;OAKG;IACI,0BAA0B,IAAI,OAAO;IAI5C;;;OAGG;IACI,6BAA6B,IAAI,aAAa,GAAG,SAAS;IAOjE;;;OAGG;IACI,gCAAgC,IAAI,IAAI;IAgB/C;;;OAGG;IACI,SAAS,IAAI,KAAK;IAIzB;;;OAGG;IACI,aAAa,IAAI,SAAS;IAOjC;;OAEG;IACI,kBAAkB,IAAI,SAAS;IAOtC;;OAEG;IACI,uBAAuB,IAAI,SAAS;IAO3C;;;;OAIG;IACI,SAAS,IAAI,KAAK;IAiBzB;;OAEG;IACI,qBAAqB,IAAI,SAAS;IAOzC;;OAEG;IACI,YAAY,IAAI,MAAM;IAI7B;;OAEG;IACI,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAW/C"}

171
node_modules/@microsoft/tsdoc/lib/parser/TokenReader.js generated vendored Normal file
View File

@@ -0,0 +1,171 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
import { TokenKind } from './Token';
import { TokenSequence } from './TokenSequence';
/**
* Manages a stream of tokens that are read by the parser.
*
* @remarks
* Use TokenReader.readToken() to read a token and advance the stream pointer.
* Use TokenReader.peekToken() to preview the next token.
* Use TokenReader.createMarker() and backtrackToMarker() to rewind to an earlier point.
* Whenever readToken() is called, the token is added to an accumulated TokenSequence
* that can be extracted by calling extractAccumulatedSequence().
*/
export class TokenReader {
constructor(parserContext, embeddedTokenSequence) {
this._parserContext = parserContext;
this.tokens = parserContext.tokens;
if (embeddedTokenSequence) {
if (embeddedTokenSequence.parserContext !== this._parserContext) {
throw new Error('The embeddedTokenSequence must use the same parser context');
}
this._readerStartIndex = embeddedTokenSequence.startIndex;
this._readerEndIndex = embeddedTokenSequence.endIndex;
}
else {
this._readerStartIndex = 0;
this._readerEndIndex = this.tokens.length;
}
this._currentIndex = this._readerStartIndex;
this._accumulatedStartIndex = this._readerStartIndex;
}
/**
* Extracts and returns the TokenSequence that was accumulated so far by calls to readToken().
* The next call to readToken() will start a new accumulated sequence.
*/
extractAccumulatedSequence() {
if (this._accumulatedStartIndex === this._currentIndex) {
// If this happens, it indicates a parser bug:
throw new Error('Parser assertion failed: The queue should not be empty when' +
' extractAccumulatedSequence() is called');
}
const sequence = new TokenSequence({
parserContext: this._parserContext,
startIndex: this._accumulatedStartIndex,
endIndex: this._currentIndex
});
this._accumulatedStartIndex = this._currentIndex;
return sequence;
}
/**
* Returns true if the accumulated sequence has any tokens yet. This will be false
* when the TokenReader starts, and it will be false immediately after a call
* to extractAccumulatedSequence(). Otherwise, it will become true whenever readToken()
* is called.
*/
isAccumulatedSequenceEmpty() {
return this._accumulatedStartIndex === this._currentIndex;
}
/**
* Like extractAccumulatedSequence(), but returns undefined if nothing has been
* accumulated yet.
*/
tryExtractAccumulatedSequence() {
if (this.isAccumulatedSequenceEmpty()) {
return undefined;
}
return this.extractAccumulatedSequence();
}
/**
* Asserts that isAccumulatedSequenceEmpty() should return false. If not, an exception
* is throw indicating a parser bug.
*/
assertAccumulatedSequenceIsEmpty() {
if (!this.isAccumulatedSequenceEmpty()) {
// If this happens, it indicates a parser bug:
const sequence = new TokenSequence({
parserContext: this._parserContext,
startIndex: this._accumulatedStartIndex,
endIndex: this._currentIndex
});
const tokenStrings = sequence.tokens.map((x) => x.toString());
throw new Error('Parser assertion failed: The queue should be empty, but it contains:\n' +
JSON.stringify(tokenStrings));
}
}
/**
* Returns the next token that would be returned by _readToken(), without
* consuming anything.
*/
peekToken() {
return this.tokens[this._currentIndex];
}
/**
* Returns the TokenKind for the next token that would be returned by _readToken(), without
* consuming anything.
*/
peekTokenKind() {
if (this._currentIndex >= this._readerEndIndex) {
return TokenKind.EndOfInput;
}
return this.tokens[this._currentIndex].kind;
}
/**
* Like peekTokenKind(), but looks ahead two tokens.
*/
peekTokenAfterKind() {
if (this._currentIndex + 1 >= this._readerEndIndex) {
return TokenKind.EndOfInput;
}
return this.tokens[this._currentIndex + 1].kind;
}
/**
* Like peekTokenKind(), but looks ahead three tokens.
*/
peekTokenAfterAfterKind() {
if (this._currentIndex + 2 >= this._readerEndIndex) {
return TokenKind.EndOfInput;
}
return this.tokens[this._currentIndex + 2].kind;
}
/**
* Extract the next token from the input stream and return it.
* The token will also be appended to the accumulated sequence, which can
* later be accessed via extractAccumulatedSequence().
*/
readToken() {
if (this._currentIndex >= this._readerEndIndex) {
// If this happens, it's a parser bug
throw new Error('Cannot read past end of stream');
}
const token = this.tokens[this._currentIndex];
if (token.kind === TokenKind.EndOfInput) {
// We don't allow reading the EndOfInput token, because we want _peekToken()
// to be always guaranteed to return a valid result.
// If this happens, it's a parser bug
throw new Error('The EndOfInput token cannot be read');
}
this._currentIndex++;
return token;
}
/**
* Returns the kind of the token immediately before the current token.
*/
peekPreviousTokenKind() {
if (this._currentIndex === 0) {
return TokenKind.EndOfInput;
}
return this.tokens[this._currentIndex - 1].kind;
}
/**
* Remembers the current position in the stream.
*/
createMarker() {
return this._currentIndex;
}
/**
* Rewinds the stream pointer to a previous position in the stream.
*/
backtrackToMarker(marker) {
if (marker > this._currentIndex) {
// If this happens, it's a parser bug
throw new Error('The marker has expired');
}
this._currentIndex = marker;
if (marker < this._accumulatedStartIndex) {
this._accumulatedStartIndex = marker;
}
}
}
//# sourceMappingURL=TokenReader.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,54 @@
import type { ParserContext } from './ParserContext';
import type { Token } from './Token';
import { TextRange } from './TextRange';
/**
* Constructor parameters for {@link TokenSequence}
*/
export interface ITokenSequenceParameters {
parserContext: ParserContext;
startIndex: number;
endIndex: number;
}
/**
* Represents a sequence of tokens extracted from `ParserContext.tokens`.
* This sequence is defined by a starting index and ending index into that array.
*/
export declare class TokenSequence {
/**
* The associated parser context that the tokens come from.
*/
readonly parserContext: ParserContext;
private _startIndex;
private _endIndex;
constructor(parameters: ITokenSequenceParameters);
/**
* Constructs a TokenSequence object with no tokens.
*/
static createEmpty(parserContext: ParserContext): TokenSequence;
/**
* The starting index into the associated `ParserContext.tokens` list.
*/
get startIndex(): number;
/**
* The (non-inclusive) ending index into the associated `ParserContext.tokens` list.
*/
get endIndex(): number;
get tokens(): ReadonlyArray<Token>;
/**
* Constructs a TokenSequence that corresponds to a different range of tokens,
* e.g. a subrange.
*/
getNewSequence(startIndex: number, endIndex: number): TokenSequence;
/**
* Returns a TextRange that includes all tokens in the sequence (including any additional
* characters between doc comment lines).
*/
getContainingTextRange(): TextRange;
isEmpty(): boolean;
/**
* Returns the concatenated text of all the tokens.
*/
toString(): string;
private _validateBounds;
}
//# sourceMappingURL=TokenSequence.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"TokenSequence.d.ts","sourceRoot":"","sources":["../../src/parser/TokenSequence.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,aAAa,EAAE,aAAa,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,qBAAa,aAAa;IACxB;;OAEG;IACH,SAAgB,aAAa,EAAE,aAAa,CAAC;IAE7C,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,SAAS,CAAS;gBAEP,UAAU,EAAE,wBAAwB;IAOvD;;OAEG;WACW,WAAW,CAAC,aAAa,EAAE,aAAa,GAAG,aAAa;IAItE;;OAEG;IACH,IAAW,UAAU,IAAI,MAAM,CAE9B;IAED;;OAEG;IACH,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED,IAAW,MAAM,IAAI,aAAa,CAAC,KAAK,CAAC,CAExC;IAED;;;OAGG;IACI,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,aAAa;IAQ1E;;;OAGG;IACI,sBAAsB,IAAI,SAAS;IAWnC,OAAO,IAAI,OAAO;IAIzB;;OAEG;IACI,QAAQ,IAAI,MAAM;IAIzB,OAAO,CAAC,eAAe;CAiBxB"}

View File

@@ -0,0 +1,84 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
import { TextRange } from './TextRange';
/**
* Represents a sequence of tokens extracted from `ParserContext.tokens`.
* This sequence is defined by a starting index and ending index into that array.
*/
export class TokenSequence {
constructor(parameters) {
this.parserContext = parameters.parserContext;
this._startIndex = parameters.startIndex;
this._endIndex = parameters.endIndex;
this._validateBounds();
}
/**
* Constructs a TokenSequence object with no tokens.
*/
static createEmpty(parserContext) {
return new TokenSequence({ parserContext, startIndex: 0, endIndex: 0 });
}
/**
* The starting index into the associated `ParserContext.tokens` list.
*/
get startIndex() {
return this._startIndex;
}
/**
* The (non-inclusive) ending index into the associated `ParserContext.tokens` list.
*/
get endIndex() {
return this._endIndex;
}
get tokens() {
return this.parserContext.tokens.slice(this._startIndex, this._endIndex);
}
/**
* Constructs a TokenSequence that corresponds to a different range of tokens,
* e.g. a subrange.
*/
getNewSequence(startIndex, endIndex) {
return new TokenSequence({
parserContext: this.parserContext,
startIndex: startIndex,
endIndex: endIndex
});
}
/**
* Returns a TextRange that includes all tokens in the sequence (including any additional
* characters between doc comment lines).
*/
getContainingTextRange() {
if (this.isEmpty()) {
return TextRange.empty;
}
return this.parserContext.sourceRange.getNewRange(this.parserContext.tokens[this._startIndex].range.pos, this.parserContext.tokens[this._endIndex - 1].range.end);
}
isEmpty() {
return this._startIndex === this._endIndex;
}
/**
* Returns the concatenated text of all the tokens.
*/
toString() {
return this.tokens.map((x) => x.toString()).join('');
}
_validateBounds() {
if (this.startIndex < 0) {
throw new Error('TokenSequence.startIndex cannot be negative');
}
if (this.endIndex < 0) {
throw new Error('TokenSequence.endIndex cannot be negative');
}
if (this.endIndex < this.startIndex) {
throw new Error('TokenSequence.endIndex cannot be smaller than TokenSequence.startIndex');
}
if (this.startIndex > this.parserContext.tokens.length) {
throw new Error('TokenSequence.startIndex cannot exceed the associated token array');
}
if (this.endIndex > this.parserContext.tokens.length) {
throw new Error('TokenSequence.endIndex cannot exceed the associated token array');
}
}
}
//# sourceMappingURL=TokenSequence.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,25 @@
import { TextRange } from './TextRange';
import { Token, TokenKind } from './Token';
export declare class Tokenizer {
private static readonly _commonMarkPunctuationCharacters;
private static readonly _wordCharacters;
private static _charCodeMap;
private static _punctuationTokens;
/**
* Given a list of input lines, this returns an array of extracted tokens.
* The last token will always be TokenKind.EndOfInput.
*/
static readTokens(lines: TextRange[]): Token[];
/**
* Returns true if the token is a CommonMark punctuation character.
* These are basically all the ASCII punctuation characters.
*/
static isPunctuation(tokenKind: TokenKind): boolean;
private static _pushTokensForLine;
/**
* Returns true if the token can be comprised of multiple characters
*/
private static _isMultiCharacterToken;
private static _ensureInitialized;
}
//# sourceMappingURL=Tokenizer.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Tokenizer.d.ts","sourceRoot":"","sources":["../../src/parser/Tokenizer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE3C,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gCAAgC,CAA+C;IACvG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAC6B;IAEpE,OAAO,CAAC,MAAM,CAAC,YAAY,CAAgD;IAC3E,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAmC;IAEpE;;;OAGG;WACW,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE;IAuBrD;;;OAGG;WACW,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO;IAK1D,OAAO,CAAC,MAAM,CAAC,kBAAkB;IA+CjC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAUrC,OAAO,CAAC,MAAM,CAAC,kBAAkB;CA0DlC"}

139
node_modules/@microsoft/tsdoc/lib/parser/Tokenizer.js generated vendored Normal file
View File

@@ -0,0 +1,139 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
import { TextRange } from './TextRange';
import { Token, TokenKind } from './Token';
export class Tokenizer {
/**
* Given a list of input lines, this returns an array of extracted tokens.
* The last token will always be TokenKind.EndOfInput.
*/
static readTokens(lines) {
Tokenizer._ensureInitialized();
const tokens = [];
let lastLine = undefined;
for (const line of lines) {
Tokenizer._pushTokensForLine(tokens, line);
lastLine = line;
}
if (lastLine) {
tokens.push(new Token(TokenKind.EndOfInput, lastLine.getNewRange(lastLine.end, lastLine.end), lastLine));
}
else {
tokens.push(new Token(TokenKind.EndOfInput, TextRange.empty, TextRange.empty));
}
return tokens;
}
/**
* Returns true if the token is a CommonMark punctuation character.
* These are basically all the ASCII punctuation characters.
*/
static isPunctuation(tokenKind) {
Tokenizer._ensureInitialized();
return Tokenizer._punctuationTokens[tokenKind] || false;
}
static _pushTokensForLine(tokens, line) {
const buffer = line.buffer;
const end = line.end;
let bufferIndex = line.pos;
let tokenKind = undefined;
let tokenPos = bufferIndex;
while (bufferIndex < end) {
// Read a character and determine its kind
const charCode = buffer.charCodeAt(bufferIndex);
let characterKind = Tokenizer._charCodeMap[charCode];
if (characterKind === undefined) {
characterKind = TokenKind.Other;
}
// Can we append to an existing token? Yes if:
// 1. There is an existing token, AND
// 2. It is the same kind of token, AND
// 3. It's not punctuation (which is always one character)
if (tokenKind !== undefined &&
characterKind === tokenKind &&
Tokenizer._isMultiCharacterToken(tokenKind)) {
// yes, append
}
else {
// Is there a previous completed token to push?
if (tokenKind !== undefined) {
tokens.push(new Token(tokenKind, line.getNewRange(tokenPos, bufferIndex), line));
}
tokenPos = bufferIndex;
tokenKind = characterKind;
}
++bufferIndex;
}
// Is there a previous completed token to push?
if (tokenKind !== undefined) {
tokens.push(new Token(tokenKind, line.getNewRange(tokenPos, bufferIndex), line));
}
tokens.push(new Token(TokenKind.Newline, line.getNewRange(line.end, line.end), line));
}
/**
* Returns true if the token can be comprised of multiple characters
*/
static _isMultiCharacterToken(kind) {
switch (kind) {
case TokenKind.Spacing:
case TokenKind.AsciiWord:
case TokenKind.Other:
return true;
}
return false;
}
static _ensureInitialized() {
if (Tokenizer._charCodeMap) {
return;
}
Tokenizer._charCodeMap = {};
Tokenizer._punctuationTokens = {};
// All Markdown punctuation characters
const punctuation = Tokenizer._commonMarkPunctuationCharacters;
for (let i = 0; i < punctuation.length; ++i) {
const charCode = punctuation.charCodeAt(i);
Tokenizer._charCodeMap[charCode] = TokenKind.OtherPunctuation;
}
// Special symbols
// !"#$%&\'()*+,\-.\/:;<=>?@[\\]^_`{|}~
const specialMap = {
'\\': TokenKind.Backslash,
'<': TokenKind.LessThan,
'>': TokenKind.GreaterThan,
'=': TokenKind.Equals,
"'": TokenKind.SingleQuote,
'"': TokenKind.DoubleQuote,
'/': TokenKind.Slash,
'-': TokenKind.Hyphen,
'@': TokenKind.AtSign,
'{': TokenKind.LeftCurlyBracket,
'}': TokenKind.RightCurlyBracket,
'`': TokenKind.Backtick,
'.': TokenKind.Period,
':': TokenKind.Colon,
',': TokenKind.Comma,
'[': TokenKind.LeftSquareBracket,
']': TokenKind.RightSquareBracket,
'|': TokenKind.Pipe,
'(': TokenKind.LeftParenthesis,
')': TokenKind.RightParenthesis,
'#': TokenKind.PoundSymbol,
'+': TokenKind.Plus,
$: TokenKind.DollarSign
};
for (const key of Object.getOwnPropertyNames(specialMap)) {
Tokenizer._charCodeMap[key.charCodeAt(0)] = specialMap[key];
Tokenizer._punctuationTokens[specialMap[key]] = true;
}
Tokenizer._punctuationTokens[TokenKind.OtherPunctuation] = true;
const word = Tokenizer._wordCharacters;
for (let i = 0; i < word.length; ++i) {
const charCode = word.charCodeAt(i);
Tokenizer._charCodeMap[charCode] = TokenKind.AsciiWord;
}
Tokenizer._charCodeMap[' '.charCodeAt(0)] = TokenKind.Spacing;
Tokenizer._charCodeMap['\t'.charCodeAt(0)] = TokenKind.Spacing;
}
}
Tokenizer._commonMarkPunctuationCharacters = '!"#$%&\'()*+,-./:;<=>?@[\\]^`{|}~';
Tokenizer._wordCharacters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_';
//# sourceMappingURL=Tokenizer.js.map

File diff suppressed because one or more lines are too long