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AAS,GAAW,WAAW,CAAC,YAAY,EAAE,CAAC;QACnD,IAAI,SAAS,GAAG,WAAW,EAAE;YAC3B,6BAA6B;YAC7B,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;SACxC;QAED,IAAI,SAAS,KAAK,WAAW,EAAE;YAC7B,EAAE,SAAS,CAAC;SACb;QAED,IAAM,aAAa,GAAkB,IAAI,6BAAa,CAAC;YACrD,aAAa,EAAE,IAAI,CAAC,cAAc;YAClC,UAAU,EAAE,WAAW;YACvB,QAAQ,EAAE,SAAS;SACpB,CAAC,CAAC;QAEH,OAAO;YACL,gBAAgB,kBAAA;YAChB,cAAc,gBAAA;YACd,eAAe,EAAE,aAAa;SAC/B,CAAC;IACJ,CAAC;IACH,iBAAC;AAAD,CAAC,AA1iFD,IA0iFC;AA1iFY,gCAAU","sourcesContent":["/* eslint-disable max-lines */\r\n\r\nimport { ParserContext } from './ParserContext';\r\nimport { Token, TokenKind } from './Token';\r\nimport { Tokenizer } from './Tokenizer';\r\nimport {\r\n DocBlockTag,\r\n DocCodeSpan,\r\n DocErrorText,\r\n DocEscapedText,\r\n DocHtmlAttribute,\r\n DocHtmlEndTag,\r\n DocHtmlStartTag,\r\n DocInlineTag,\r\n DocNode,\r\n DocPlainText,\r\n DocSoftBreak,\r\n EscapeStyle,\r\n DocComment,\r\n DocBlock,\r\n DocNodeKind,\r\n DocSection,\r\n DocParamBlock,\r\n DocFencedCode,\r\n DocLinkTag,\r\n IDocLinkTagParameters,\r\n DocMemberReference,\r\n DocDeclarationReference,\r\n DocMemberSymbol,\r\n DocMemberIdentifier,\r\n DocMemberSelector,\r\n DocInheritDocTag,\r\n IDocInheritDocTagParameters,\r\n IDocInlineTagParsedParameters,\r\n DocInlineTagBase,\r\n IDocLinkTagParsedParameters,\r\n IDocMemberReferenceParsedParameters\r\n} from '../nodes';\r\nimport { TokenSequence } from './TokenSequence';\r\nimport { TokenReader } from './TokenReader';\r\nimport { StringChecks } from './StringChecks';\r\nimport { ModifierTagSet } from '../details/ModifierTagSet';\r\nimport { TSDocConfiguration } from '../configuration/TSDocConfiguration';\r\nimport { TSDocTagDefinition, TSDocTagSyntaxKind } from '../configuration/TSDocTagDefinition';\r\nimport { StandardTags } from '../details/StandardTags';\r\nimport { PlainTextEmitter } from '../emitters/PlainTextEmitter';\r\nimport { TSDocMessageId } from './TSDocMessageId';\r\n\r\ninterface IFailure {\r\n // (We use \"failureMessage\" instead of \"errorMessage\" here so that DocErrorText doesn't\r\n // accidentally implement this interface.)\r\n failureMessageId: TSDocMessageId;\r\n failureMessage: string;\r\n failureLocation: TokenSequence;\r\n}\r\n\r\ntype ResultOrFailure<T> = T | IFailure;\r\n\r\nfunction isFailure<T>(resultOrFailure: ResultOrFailure<T>): resultOrFailure is IFailure {\r\n return resultOrFailure !== undefined && Object.hasOwnProperty.call(resultOrFailure, 'failureMessage');\r\n}\r\n\r\n/**\r\n * The main parser for TSDoc comments.\r\n */\r\nexport class NodeParser {\r\n private readonly _parserContext: ParserContext;\r\n private readonly _configuration: TSDocConfiguration;\r\n private _currentSection: DocSection;\r\n\r\n public constructor(parserContext: ParserContext) {\r\n this._parserContext = parserContext;\r\n this._configuration = parserContext.configuration;\r\n\r\n this._currentSection = parserContext.docComment.summarySection;\r\n }\r\n\r\n public parse(): void {\r\n const tokenReader: TokenReader = new TokenReader(this._parserContext);\r\n\r\n let done: boolean = false;\r\n while (!done) {\r\n // Extract the next token\r\n switch (tokenReader.peekTokenKind()) {\r\n case TokenKind.EndOfInput:\r\n done = true;\r\n break;\r\n case TokenKind.Newline:\r\n this._pushAccumulatedPlainText(tokenReader);\r\n tokenReader.readToken();\r\n this._pushNode(\r\n new DocSoftBreak({\r\n parsed: true,\r\n configuration: this._configuration,\r\n softBreakExcerpt: tokenReader.extractAccumulatedSequence()\r\n })\r\n );\r\n break;\r\n case TokenKind.Backslash:\r\n this._pushAccumulatedPlainText(tokenReader);\r\n this._pushNode(this._parseBackslashEscape(tokenReader));\r\n break;\r\n case TokenKind.AtSign:\r\n this._pushAccumulatedPlainText(tokenReader);\r\n this._parseAndPushBlock(tokenReader);\r\n break;\r\n case TokenKind.LeftCurlyBracket: {\r\n this._pushAccumulatedPlainText(tokenReader);\r\n\r\n const marker: number = tokenReader.createMarker();\r\n const docNode: DocNode = this._parseInlineTag(tokenReader);\r\n const docComment: DocComment = this._parserContext.docComment;\r\n\r\n if (docNode instanceof DocInheritDocTag) {\r\n // The @inheritDoc tag is irregular because it looks like an inline tag, but\r\n // it actually represents the entire comment body\r\n const tagEndMarker: number = tokenReader.createMarker() - 1;\r\n if (docComment.inheritDocTag === undefined) {\r\n this._parserContext.docComment.inheritDocTag = docNode;\r\n } else {\r\n this._pushNode(\r\n this._backtrackAndCreateErrorRange(\r\n tokenReader,\r\n marker,\r\n tagEndMarker,\r\n TSDocMessageId.ExtraInheritDocTag,\r\n 'A doc comment cannot have more than one @inheritDoc tag'\r\n )\r\n );\r\n }\r\n } else {\r\n this._pushNode(docNode);\r\n }\r\n break;\r\n }\r\n case TokenKind.RightCurlyBracket:\r\n this._pushAccumulatedPlainText(tokenReader);\r\n this._pushNode(\r\n this._createError(\r\n tokenReader,\r\n TSDocMessageId.EscapeRightBrace,\r\n 'The \"}\" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag'\r\n )\r\n );\r\n break;\r\n case TokenKind.LessThan:\r\n this._pushAccumulatedPlainText(tokenReader);\r\n // Look ahead two tokens to see if this is \"<a>\" or \"</a>\".\r\n if (tokenReader.peekTokenAfterKind() === TokenKind.Slash) {\r\n this._pushNode(this._parseHtmlEndTag(tokenReader));\r\n } else {\r\n this._pushNode(this._parseHtmlStartTag(tokenReader));\r\n }\r\n break;\r\n case TokenKind.GreaterThan:\r\n this._pushAccumulatedPlainText(tokenReader);\r\n this._pushNode(\r\n this._createError(\r\n tokenReader,\r\n TSDocMessageId.EscapeGreaterThan,\r\n 'The \">\" character should be escaped using a backslash to avoid confusion with an HTML tag'\r\n )\r\n );\r\n break;\r\n case TokenKind.Backtick:\r\n this._pushAccumulatedPlainText(tokenReader);\r\n\r\n if (\r\n tokenReader.peekTokenAfterKind() === TokenKind.Backtick &&\r\n tokenReader.peekTokenAfterAfterKind() === TokenKind.Backtick\r\n ) {\r\n this._pushNode(this._parseFencedCode(tokenReader));\r\n } else {\r\n this._pushNode(this._parseCodeSpan(tokenReader));\r\n }\r\n break;\r\n default:\r\n // If nobody recognized this token, then accumulate plain text\r\n tokenReader.readToken();\r\n break;\r\n }\r\n }\r\n this._pushAccumulatedPlainText(tokenReader);\r\n this._performValidationChecks();\r\n }\r\n\r\n private _performValidationChecks(): void {\r\n const docComment: DocComment = this._parserContext.docComment;\r\n if (docComment.deprecatedBlock) {\r\n if (!PlainTextEmitter.hasAnyTextContent(docComment.deprecatedBlock)) {\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.MissingDeprecationMessage,\r\n `The ${docComment.deprecatedBlock.blockTag.tagName} block must include a deprecation message,` +\r\n ` e.g. describing the recommended alternative`,\r\n docComment.deprecatedBlock.blockTag.getTokenSequence(),\r\n docComment.deprecatedBlock\r\n );\r\n }\r\n }\r\n\r\n if (docComment.inheritDocTag) {\r\n if (docComment.remarksBlock) {\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.InheritDocIncompatibleTag,\r\n `A \"${docComment.remarksBlock.blockTag.tagName}\" block must not be used, because that` +\r\n ` content is provided by the @inheritDoc tag`,\r\n docComment.remarksBlock.blockTag.getTokenSequence(),\r\n docComment.remarksBlock.blockTag\r\n );\r\n }\r\n if (PlainTextEmitter.hasAnyTextContent(docComment.summarySection)) {\r\n this._parserContext.log.addMessageForTextRange(\r\n TSDocMessageId.InheritDocIncompatibleSummary,\r\n 'The summary section must not have any content, because that' +\r\n ' content is provided by the @inheritDoc tag',\r\n this._parserContext.commentRange\r\n );\r\n }\r\n }\r\n }\r\n\r\n private _validateTagDefinition(\r\n tagDefinition: TSDocTagDefinition | undefined,\r\n tagName: string,\r\n expectingInlineTag: boolean,\r\n tokenSequenceForErrorContext: TokenSequence,\r\n nodeForErrorContext: DocNode\r\n ): void {\r\n if (tagDefinition) {\r\n const isInlineTag: boolean = tagDefinition.syntaxKind === TSDocTagSyntaxKind.InlineTag;\r\n\r\n if (isInlineTag !== expectingInlineTag) {\r\n // The tag is defined, but it is used incorrectly\r\n if (expectingInlineTag) {\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.TagShouldNotHaveBraces,\r\n `The TSDoc tag \"${tagName}\" is not an inline tag; it must not be enclosed in \"{ }\" braces`,\r\n tokenSequenceForErrorContext,\r\n nodeForErrorContext\r\n );\r\n } else {\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.InlineTagMissingBraces,\r\n `The TSDoc tag \"${tagName}\" is an inline tag; it must be enclosed in \"{ }\" braces`,\r\n tokenSequenceForErrorContext,\r\n nodeForErrorContext\r\n );\r\n }\r\n } else {\r\n if (this._parserContext.configuration.validation.reportUnsupportedTags) {\r\n if (!this._parserContext.configuration.isTagSupported(tagDefinition)) {\r\n // The tag is defined, but not supported\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.UnsupportedTag,\r\n `The TSDoc tag \"${tagName}\" is not supported by this tool`,\r\n tokenSequenceForErrorContext,\r\n nodeForErrorContext\r\n );\r\n }\r\n }\r\n }\r\n } else {\r\n // The tag is not defined\r\n if (!this._parserContext.configuration.validation.ignoreUndefinedTags) {\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.UndefinedTag,\r\n `The TSDoc tag \"${tagName}\" is not defined in this configuration`,\r\n tokenSequenceForErrorContext,\r\n nodeForErrorContext\r\n );\r\n }\r\n }\r\n }\r\n\r\n private _pushAccumulatedPlainText(tokenReader: TokenReader): void {\r\n if (!tokenReader.isAccumulatedSequenceEmpty()) {\r\n this._pushNode(\r\n new DocPlainText({\r\n parsed: true,\r\n configuration: this._configuration,\r\n textExcerpt: tokenReader.extractAccumulatedSequence()\r\n })\r\n );\r\n }\r\n }\r\n\r\n private _parseAndPushBlock(tokenReader: TokenReader): void {\r\n const docComment: DocComment = this._parserContext.docComment;\r\n const configuration: TSDocConfiguration = this._parserContext.configuration;\r\n const modifierTagSet: ModifierTagSet = docComment.modifierTagSet;\r\n\r\n const parsedBlockTag: DocNode = this._parseBlockTag(tokenReader);\r\n if (parsedBlockTag.kind !== DocNodeKind.BlockTag) {\r\n this._pushNode(parsedBlockTag);\r\n return;\r\n }\r\n\r\n const docBlockTag: DocBlockTag = parsedBlockTag as DocBlockTag;\r\n\r\n // Do we have a definition for this tag?\r\n const tagDefinition: TSDocTagDefinition | undefined = configuration.tryGetTagDefinitionWithUpperCase(\r\n docBlockTag.tagNameWithUpperCase\r\n );\r\n this._validateTagDefinition(\r\n tagDefinition,\r\n docBlockTag.tagName,\r\n /* expectingInlineTag */ false,\r\n docBlockTag.getTokenSequence(),\r\n docBlockTag\r\n );\r\n\r\n if (tagDefinition) {\r\n switch (tagDefinition.syntaxKind) {\r\n case TSDocTagSyntaxKind.BlockTag:\r\n if (docBlockTag.tagNameWithUpperCase === StandardTags.param.tagNameWithUpperCase) {\r\n const docParamBlock: DocParamBlock = this._parseParamBlock(\r\n tokenReader,\r\n docBlockTag,\r\n StandardTags.param.tagName\r\n );\r\n\r\n this._parserContext.docComment.params.add(docParamBlock);\r\n\r\n this._currentSection = docParamBlock.content;\r\n return;\r\n } else if (docBlockTag.tagNameWithUpperCase === StandardTags.typeParam.tagNameWithUpperCase) {\r\n const docParamBlock: DocParamBlock = this._parseParamBlock(\r\n tokenReader,\r\n docBlockTag,\r\n StandardTags.typeParam.tagName\r\n );\r\n\r\n this._parserContext.docComment.typeParams.add(docParamBlock);\r\n\r\n this._currentSection = docParamBlock.content;\r\n return;\r\n } else {\r\n const newBlock: DocBlock = new DocBlock({\r\n configuration: this._configuration,\r\n blockTag: docBlockTag\r\n });\r\n\r\n this._addBlockToDocComment(newBlock);\r\n\r\n this._currentSection = newBlock.content;\r\n }\r\n\r\n return;\r\n case TSDocTagSyntaxKind.ModifierTag:\r\n // The block tag was recognized as a modifier, so add it to the modifier tag set\r\n // and do NOT call currentSection.appendNode(parsedNode)\r\n modifierTagSet.addTag(docBlockTag);\r\n return;\r\n }\r\n }\r\n\r\n this._pushNode(docBlockTag);\r\n }\r\n\r\n private _addBlockToDocComment(block: DocBlock): void {\r\n const docComment: DocComment = this._parserContext.docComment;\r\n\r\n switch (block.blockTag.tagNameWithUpperCase) {\r\n case StandardTags.remarks.tagNameWithUpperCase:\r\n docComment.remarksBlock = block;\r\n break;\r\n case StandardTags.privateRemarks.tagNameWithUpperCase:\r\n docComment.privateRemarks = block;\r\n break;\r\n case StandardTags.deprecated.tagNameWithUpperCase:\r\n docComment.deprecatedBlock = block;\r\n break;\r\n case StandardTags.returns.tagNameWithUpperCase:\r\n docComment.returnsBlock = block;\r\n break;\r\n case StandardTags.see.tagNameWithUpperCase:\r\n docComment._appendSeeBlock(block);\r\n break;\r\n default:\r\n docComment.appendCustomBlock(block);\r\n }\r\n }\r\n\r\n /**\r\n * Used by `_parseParamBlock()`, this parses a JSDoc expression remainder like `string}` or `=\"]\"]` from\r\n * an input like `@param {string} [x=\"]\"] - the X value`. It detects nested balanced pairs of delimiters\r\n * and escaped string literals.\r\n */\r\n private _tryParseJSDocTypeOrValueRest(\r\n tokenReader: TokenReader,\r\n openKind: TokenKind,\r\n closeKind: TokenKind,\r\n startMarker: number\r\n ): TokenSequence | undefined {\r\n let quoteKind: TokenKind | undefined;\r\n let openCount: number = 1;\r\n while (openCount > 0) {\r\n let tokenKind: TokenKind = tokenReader.peekTokenKind();\r\n switch (tokenKind) {\r\n case openKind:\r\n // ignore open bracket/brace inside of a quoted string\r\n if (quoteKind === undefined) openCount++;\r\n break;\r\n case closeKind:\r\n // ignore close bracket/brace inside of a quoted string\r\n if (quoteKind === undefined) openCount--;\r\n break;\r\n case TokenKind.Backslash:\r\n // ignore backslash outside of quoted string\r\n if (quoteKind !== undefined) {\r\n // skip the backslash and the next character.\r\n tokenReader.readToken();\r\n tokenKind = tokenReader.peekTokenKind();\r\n }\r\n break;\r\n case TokenKind.DoubleQuote:\r\n case TokenKind.SingleQuote:\r\n case TokenKind.Backtick:\r\n if (quoteKind === tokenKind) {\r\n // exit quoted string if quote character matches.\r\n quoteKind = undefined;\r\n } else if (quoteKind === undefined) {\r\n // start quoted string if not in a quoted string.\r\n quoteKind = tokenKind;\r\n }\r\n break;\r\n }\r\n // give up at end of input and backtrack to start.\r\n if (tokenKind === TokenKind.EndOfInput) {\r\n tokenReader.backtrackToMarker(startMarker);\r\n return undefined;\r\n }\r\n tokenReader.readToken();\r\n }\r\n return tokenReader.tryExtractAccumulatedSequence();\r\n }\r\n\r\n /**\r\n * Used by `_parseParamBlock()`, this parses a JSDoc expression like `{string}` from\r\n * an input like `@param {string} x - the X value`.\r\n */\r\n private _tryParseUnsupportedJSDocType(\r\n tokenReader: TokenReader,\r\n docBlockTag: DocBlockTag,\r\n tagName: string\r\n ): TokenSequence | undefined {\r\n tokenReader.assertAccumulatedSequenceIsEmpty();\r\n\r\n // do not parse `{@...` as a JSDoc type\r\n if (\r\n tokenReader.peekTokenKind() !== TokenKind.LeftCurlyBracket ||\r\n tokenReader.peekTokenAfterKind() === TokenKind.AtSign\r\n ) {\r\n return undefined;\r\n }\r\n\r\n const startMarker: number = tokenReader.createMarker();\r\n tokenReader.readToken(); // read the \"{\"\r\n\r\n let jsdocTypeExcerpt: TokenSequence | undefined = this._tryParseJSDocTypeOrValueRest(\r\n tokenReader,\r\n TokenKind.LeftCurlyBracket,\r\n TokenKind.RightCurlyBracket,\r\n startMarker\r\n );\r\n\r\n if (jsdocTypeExcerpt) {\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.ParamTagWithInvalidType,\r\n 'The ' + tagName + \" block should not include a JSDoc-style '{type}'\",\r\n jsdocTypeExcerpt,\r\n docBlockTag\r\n );\r\n\r\n const spacingAfterJsdocTypeExcerpt: TokenSequence | undefined = this._tryReadSpacingAndNewlines(\r\n tokenReader\r\n );\r\n if (spacingAfterJsdocTypeExcerpt) {\r\n jsdocTypeExcerpt = jsdocTypeExcerpt.getNewSequence(\r\n jsdocTypeExcerpt.startIndex,\r\n spacingAfterJsdocTypeExcerpt.endIndex\r\n );\r\n }\r\n }\r\n return jsdocTypeExcerpt;\r\n }\r\n\r\n /**\r\n * Used by `_parseParamBlock()`, this parses a JSDoc expression remainder like `=[]]` from\r\n * an input like `@param {string} [x=[]] - the X value`.\r\n */\r\n private _tryParseJSDocOptionalNameRest(tokenReader: TokenReader): TokenSequence | undefined {\r\n tokenReader.assertAccumulatedSequenceIsEmpty();\r\n if (tokenReader.peekTokenKind() !== TokenKind.EndOfInput) {\r\n const startMarker: number = tokenReader.createMarker();\r\n return this._tryParseJSDocTypeOrValueRest(\r\n tokenReader,\r\n TokenKind.LeftSquareBracket,\r\n TokenKind.RightSquareBracket,\r\n startMarker\r\n );\r\n }\r\n return undefined;\r\n }\r\n\r\n private _parseParamBlock(\r\n tokenReader: TokenReader,\r\n docBlockTag: DocBlockTag,\r\n tagName: string\r\n ): DocParamBlock {\r\n const startMarker: number = tokenReader.createMarker();\r\n\r\n const spacingBeforeParameterNameExcerpt: TokenSequence | undefined = this._tryReadSpacingAndNewlines(\r\n tokenReader\r\n );\r\n\r\n // Skip past a JSDoc type (i.e., '@param {type} paramName') if found, and report a warning.\r\n const unsupportedJsdocTypeBeforeParameterNameExcerpt:\r\n | TokenSequence\r\n | undefined = this._tryParseUnsupportedJSDocType(tokenReader, docBlockTag, tagName);\r\n\r\n // Parse opening of invalid JSDoc optional parameter name (e.g., '[')\r\n let unsupportedJsdocOptionalNameOpenBracketExcerpt: TokenSequence | undefined;\r\n if (tokenReader.peekTokenKind() === TokenKind.LeftSquareBracket) {\r\n tokenReader.readToken(); // read the \"[\"\r\n unsupportedJsdocOptionalNameOpenBracketExcerpt = tokenReader.extractAccumulatedSequence();\r\n }\r\n\r\n let parameterName: string = '';\r\n\r\n let done: boolean = false;\r\n while (!done) {\r\n switch (tokenReader.peekTokenKind()) {\r\n case TokenKind.AsciiWord:\r\n case TokenKind.Period:\r\n case TokenKind.DollarSign:\r\n parameterName += tokenReader.readToken();\r\n break;\r\n default:\r\n done = true;\r\n break;\r\n }\r\n }\r\n\r\n const explanation: string | undefined = StringChecks.explainIfInvalidUnquotedIdentifier(parameterName);\r\n\r\n if (explanation !== undefined) {\r\n tokenReader.backtrackToMarker(startMarker);\r\n\r\n const errorParamBlock: DocParamBlock = new DocParamBlock({\r\n configuration: this._configuration,\r\n blockTag: docBlockTag,\r\n parameterName: ''\r\n });\r\n const errorMessage: string =\r\n parameterName.length > 0\r\n ? 'The ' + tagName + ' block should be followed by a valid parameter name: ' + explanation\r\n : 'The ' + tagName + ' block should be followed by a parameter name';\r\n\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.ParamTagWithInvalidName,\r\n errorMessage,\r\n docBlockTag.getTokenSequence(),\r\n docBlockTag\r\n );\r\n return errorParamBlock;\r\n }\r\n\r\n const parameterNameExcerpt: TokenSequence = tokenReader.extractAccumulatedSequence();\r\n\r\n // Parse closing of invalid JSDoc optional parameter name (e.g., ']', '=default]').\r\n let unsupportedJsdocOptionalNameRestExcerpt: TokenSequence | undefined;\r\n if (unsupportedJsdocOptionalNameOpenBracketExcerpt) {\r\n unsupportedJsdocOptionalNameRestExcerpt = this._tryParseJSDocOptionalNameRest(tokenReader);\r\n\r\n let errorSequence: TokenSequence | undefined = unsupportedJsdocOptionalNameOpenBracketExcerpt;\r\n if (unsupportedJsdocOptionalNameRestExcerpt) {\r\n errorSequence = docBlockTag\r\n .getTokenSequence()\r\n .getNewSequence(\r\n unsupportedJsdocOptionalNameOpenBracketExcerpt.startIndex,\r\n unsupportedJsdocOptionalNameRestExcerpt.endIndex\r\n );\r\n }\r\n\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.ParamTagWithInvalidOptionalName,\r\n 'The ' +\r\n tagName +\r\n \" should not include a JSDoc-style optional name; it must not be enclosed in '[ ]' brackets.\",\r\n errorSequence,\r\n docBlockTag\r\n );\r\n }\r\n\r\n const spacingAfterParameterNameExcerpt: TokenSequence | undefined = this._tryReadSpacingAndNewlines(\r\n tokenReader\r\n );\r\n\r\n // Skip past a trailing JSDoc type (i.e., '@param paramName {type}') if found, and report a warning.\r\n const unsupportedJsdocTypeAfterParameterNameExcerpt:\r\n | TokenSequence\r\n | undefined = this._tryParseUnsupportedJSDocType(tokenReader, docBlockTag, tagName);\r\n\r\n // TODO: Warn if there is no space before or after the hyphen\r\n let hyphenExcerpt: TokenSequence | undefined;\r\n let spacingAfterHyphenExcerpt: TokenSequence | undefined;\r\n let unsupportedJsdocTypeAfterHyphenExcerpt: TokenSequence | undefined;\r\n if (tokenReader.peekTokenKind() === TokenKind.Hyphen) {\r\n tokenReader.readToken();\r\n hyphenExcerpt = tokenReader.extractAccumulatedSequence();\r\n // TODO: Only read one space\r\n spacingAfterHyphenExcerpt = this._tryReadSpacingAndNewlines(tokenReader);\r\n\r\n // Skip past a JSDoc type (i.e., '@param paramName - {type}') if found, and report a warning.\r\n unsupportedJsdocTypeAfterHyphenExcerpt = this._tryParseUnsupportedJSDocType(\r\n tokenReader,\r\n docBlockTag,\r\n tagName\r\n );\r\n } else {\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.ParamTagMissingHyphen,\r\n 'The ' + tagName + ' block should be followed by a parameter name and then a hyphen',\r\n docBlockTag.getTokenSequence(),\r\n docBlockTag\r\n );\r\n }\r\n\r\n return new DocParamBlock({\r\n parsed: true,\r\n configuration: this._configuration,\r\n\r\n blockTag: docBlockTag,\r\n\r\n spacingBeforeParameterNameExcerpt,\r\n\r\n unsupportedJsdocTypeBeforeParameterNameExcerpt,\r\n unsupportedJsdocOptionalNameOpenBracketExcerpt,\r\n\r\n parameterNameExcerpt,\r\n parameterName,\r\n\r\n unsupportedJsdocOptionalNameRestExcerpt,\r\n\r\n spacingAfterParameterNameExcerpt,\r\n\r\n unsupportedJsdocTypeAfterParameterNameExcerpt,\r\n\r\n hyphenExcerpt,\r\n\r\n spacingAfterHyphenExcerpt,\r\n\r\n unsupportedJsdocTypeAfterHyphenExcerpt\r\n });\r\n }\r\n\r\n private _pushNode(docNode: DocNode): void {\r\n if (this._configuration.docNodeManager.isAllowedChild(DocNodeKind.Paragraph, docNode.kind)) {\r\n this._currentSection.appendNodeInParagraph(docNode);\r\n } else {\r\n this._currentSection.appendNode(docNode);\r\n }\r\n }\r\n\r\n private _parseBackslashEscape(tokenReader: TokenReader): DocNode {\r\n tokenReader.assertAccumulatedSequenceIsEmpty();\r\n const marker: number = tokenReader.createMarker();\r\n\r\n tokenReader.readToken(); // read the backslash\r\n\r\n if (tokenReader.peekTokenKind() === TokenKind.EndOfInput) {\r\n return this._backtrackAndCreateError(\r\n tokenReader,\r\n marker,\r\n TSDocMessageId.UnnecessaryBackslash,\r\n 'A backslash must precede another character that is being escaped'\r\n );\r\n }\r\n\r\n const escapedToken: Token = tokenReader.readToken(); // read the escaped character\r\n\r\n // In CommonMark, a backslash is only allowed before a punctuation\r\n // character. In all other contexts, the backslash is interpreted as a\r\n // literal character.\r\n if (!Tokenizer.isPunctuation(escapedToken.kind)) {\r\n return this._backtrackAndCreateError(\r\n tokenReader,\r\n marker,\r\n TSDocMessageId.UnnecessaryBackslash,\r\n 'A backslash can only be used to escape a punctuation character'\r\n );\r\n }\r\n\r\n const encodedTextExcerpt: TokenSequence = tokenReader.extractAccumulatedSequence();\r\n\r\n return new DocEscapedText({\r\n parsed: true,\r\n configuration: this._configuration,\r\n\r\n escapeStyle: EscapeStyle.CommonMarkBackslash,\r\n encodedTextExcerpt,\r\n decodedText: escapedToken.toString()\r\n });\r\n }\r\n\r\n private _parseBlockTag(tokenReader: TokenReader): DocNode {\r\n tokenReader.assertAccumulatedSequenceIsEmpty();\r\n const marker: number = tokenReader.createMarker();\r\n\r\n if (tokenReader.peekTokenKind() !== TokenKind.AtSign) {\r\n return this._backtrackAndCreateError(\r\n tokenReader,\r\n marker,\r\n TSDocMessageId.MissingTag,\r\n 'Expecting a TSDoc tag starting with \"@\"'\r\n );\r\n }\r\n\r\n // \"@one\" is a valid TSDoc tag at the start of a line, but \"@one@two\" is\r\n // a syntax error. For two tags it should be \"@one @two\", or for literal text it\r\n // should be \"\\@one\\@two\".\r\n switch (tokenReader.peekPreviousTokenKind()) {\r\n case TokenKind.EndOfInput:\r\n case TokenKind.Spacing:\r\n case TokenKind.Newline:\r\n break;\r\n default:\r\n return this._backtrackAndCreateError(\r\n tokenReader,\r\n marker,\r\n TSDocMessageId.AtSignInWord,\r\n 'The \"@\" character looks like part of a TSDoc tag; use a backslash to escape it'\r\n );\r\n }\r\n\r\n // Include the \"@\" as part of the tagName\r\n let tagName: string = tokenReader.readToken().toString();\r\n\r\n if (tokenReader.peekTokenKind() !== TokenKind.AsciiWord) {\r\n return this._backtrackAndCreateError(\r\n tokenReader,\r\n marker,\r\n TSDocMessageId.AtSignWithoutTagName,\r\n 'Expecting a TSDoc tag name after \"@\"; if it is not a tag, use a backslash to escape this character'\r\n );\r\n }\r\n\r\n const tagNameMarker: number = tokenReader.createMarker();\r\n\r\n while (tokenReader.peekTokenKind() === TokenKind.AsciiWord) {\r\n tagName += tokenReader.readToken().toString();\r\n }\r\n\r\n switch (tokenReader.peekTokenKind()) {\r\n case TokenKind.Spacing:\r\n case TokenKind.Newline:\r\n case TokenKind.EndOfInput:\r\n break;\r\n default:\r\n const badCharacter: string = tokenReader.peekToken().range.toString()[0];\r\n return this._backtrackAndCreateError(\r\n tokenReader,\r\n marker,\r\n TSDocMessageId.CharactersAfterBlockTag,\r\n `The token \"${tagName}\" looks like a TSDoc tag but contains an invalid character` +\r\n ` ${JSON.stringify(badCharacter)}; if it is not a tag, use a backslash to escape the \"@\"`\r\n );\r\n }\r\n\r\n if (StringChecks.explainIfInvalidTSDocTagName(tagName)) {\r\n const failure: IFailure = this._createFailureForTokensSince(\r\n tokenReader,\r\n TSDocMessageId.MalformedTagName,\r\n 'A TSDoc tag name must start with a letter and contain only letters and numbers',\r\n tagNameMarker\r\n );\r\n return this._backtrackAndCreateErrorForFailure(tokenReader, marker, '', failure);\r\n }\r\n\r\n return new DocBlockTag({\r\n parsed: true,\r\n configuration: this._configuration,\r\n\r\n tagName,\r\n tagNameExcerpt: tokenReader.extractAccumulatedSequence()\r\n });\r\n }\r\n\r\n private _parseInlineTag(tokenReader: TokenReader): DocNode {\r\n tokenReader.assertAccumulatedSequenceIsEmpty();\r\n const marker: number = tokenReader.createMarker();\r\n\r\n if (tokenReader.peekTokenKind() !== TokenKind.LeftCurlyBracket) {\r\n return this._backtrackAndCreateError(\r\n tokenReader,\r\n marker,\r\n TSDocMessageId.MissingTag,\r\n 'Expecting a TSDoc tag starting with \"{\"'\r\n );\r\n }\r\n tokenReader.readToken();\r\n\r\n const openingDelimiterExcerpt: TokenSequence = tokenReader.extractAccumulatedSequence();\r\n\r\n // For inline tags, if we handle errors by backtracking to the \"{\" token, then the main loop\r\n // will then interpret the \"@\" as a block tag, which is almost certainly incorrect. So the\r\n // DocErrorText needs to include both the \"{\" and \"@\" tokens.\r\n // We will use _backtrackAndCreateErrorRangeForFailure() for that.\r\n const atSignMarker: number = tokenReader.createMarker();\r\n\r\n if (tokenReader.peekTokenKind() !== TokenKind.AtSign) {\r\n return this._backtrackAndCreateError(\r\n tokenReader,\r\n marker,\r\n TSDocMessageId.MalformedInlineTag,\r\n 'Expecting a TSDoc tag starting with \"{@\"'\r\n );\r\n }\r\n\r\n // Include the \"@\" as part of the tagName\r\n let tagName: string = tokenReader.readToken().toString();\r\n\r\n while (tokenReader.peekTokenKind() === TokenKind.AsciiWord) {\r\n tagName += tokenReader.readToken().toString();\r\n }\r\n\r\n if (tagName === '@') {\r\n // This is an unusual case\r\n const failure: IFailure = this._createFailureForTokensSince(\r\n tokenReader,\r\n TSDocMessageId.MalformedInlineTag,\r\n 'Expecting a TSDoc inline tag name after the \"{@\" characters',\r\n atSignMarker\r\n );\r\n return this._backtrackAndCreateErrorRangeForFailure(tokenReader, marker, atSignMarker, '', failure);\r\n }\r\n\r\n if (StringChecks.explainIfInvalidTSDocTagName(tagName)) {\r\n const failure: IFailure = this._createFailureForTokensSince(\r\n tokenReader,\r\n TSDocMessageId.MalformedTagName,\r\n 'A TSDoc tag name must start with a letter and contain only letters and numbers',\r\n atSignMarker\r\n );\r\n return this._backtrackAndCreateErrorRangeForFailure(tokenReader, marker, atSignMarker, '', failure);\r\n }\r\n\r\n const tagNameExcerpt: TokenSequence = tokenReader.extractAccumulatedSequence();\r\n\r\n const spacingAfterTagNameExcerpt: TokenSequence | undefined = this._tryReadSpacingAndNewlines(\r\n tokenReader\r\n );\r\n\r\n if (spacingAfterTagNameExcerpt === undefined) {\r\n // If there were no spaces at all, that's an error unless it's the degenerate \"{@tag}\" case\r\n if (tokenReader.peekTokenKind() !== TokenKind.RightCurlyBracket) {\r\n const badCharacter: string = tokenReader.peekToken().range.toString()[0];\r\n const failure: IFailure = this._createFailureForToken(\r\n tokenReader,\r\n TSDocMessageId.CharactersAfterInlineTag,\r\n `The character ${JSON.stringify(\r\n badCharacter\r\n )} cannot appear after the TSDoc tag name; expecting a space`\r\n );\r\n return this._backtrackAndCreateErrorRangeForFailure(tokenReader, marker, atSignMarker, '', failure);\r\n }\r\n }\r\n\r\n let done: boolean = false;\r\n while (!done) {\r\n switch (tokenReader.peekTokenKind()) {\r\n case TokenKind.EndOfInput:\r\n return this._backtrackAndCreateErrorRange(\r\n tokenReader,\r\n marker,\r\n atSignMarker,\r\n TSDocMessageId.InlineTagMissingRightBrace,\r\n 'The TSDoc inline tag name is missing its closing \"}\"'\r\n );\r\n case TokenKind.Backslash:\r\n // http://usejsdoc.org/about-block-inline-tags.html\r\n // \"If your tag's text includes a closing curly brace (}), you must escape it with\r\n // a leading backslash (\\).\"\r\n tokenReader.readToken(); // discard the backslash\r\n\r\n // In CommonMark, a backslash is only allowed before a punctuation\r\n // character. In all other contexts, the backslash is interpreted as a\r\n // literal character.\r\n if (!Tokenizer.isPunctuation(tokenReader.peekTokenKind())) {\r\n const failure: IFailure = this._createFailureForToken(\r\n tokenReader,\r\n TSDocMessageId.UnnecessaryBackslash,\r\n 'A backslash can only be used to escape a punctuation character'\r\n );\r\n return this._backtrackAndCreateErrorRangeForFailure(\r\n tokenReader,\r\n marker,\r\n atSignMarker,\r\n 'Error reading inline TSDoc tag: ',\r\n failure\r\n );\r\n }\r\n\r\n tokenReader.readToken();\r\n break;\r\n case TokenKind.LeftCurlyBracket: {\r\n const failure: IFailure = this._createFailureForToken(\r\n tokenReader,\r\n TSDocMessageId.InlineTagUnescapedBrace,\r\n 'The \"{\" character must be escaped with a backslash when used inside a TSDoc inline tag'\r\n );\r\n return this._backtrackAndCreateErrorRangeForFailure(tokenReader, marker, atSignMarker, '', failure);\r\n }\r\n case TokenKind.RightCurlyBracket:\r\n done = true;\r\n break;\r\n default:\r\n tokenReader.readToken();\r\n break;\r\n }\r\n }\r\n\r\n const tagContentExcerpt: TokenSequence | undefined = tokenReader.tryExtractAccumulatedSequence();\r\n\r\n // Read the right curly bracket\r\n tokenReader.readToken();\r\n const closingDelimiterExcerpt: TokenSequence = tokenReader.extractAccumulatedSequence();\r\n\r\n const docInlineTagParsedParameters: IDocInlineTagParsedParameters = {\r\n parsed: true,\r\n configuration: this._configuration,\r\n\r\n openingDelimiterExcerpt,\r\n\r\n tagNameExcerpt,\r\n tagName,\r\n spacingAfterTagNameExcerpt,\r\n\r\n tagContentExcerpt,\r\n\r\n closingDelimiterExcerpt\r\n };\r\n\r\n const tagNameWithUpperCase: string = tagName.toUpperCase();\r\n\r\n // Create a new TokenReader that will reparse the tokens corresponding to the tagContent.\r\n const embeddedTokenReader: TokenReader = new TokenReader(\r\n this._parserContext,\r\n tagContentExcerpt ? tagContentExcerpt : TokenSequence.createEmpty(this._parserContext)\r\n );\r\n\r\n let docNode: DocNode;\r\n switch (tagNameWithUpperCase) {\r\n case StandardTags.inheritDoc.tagNameWithUpperCase:\r\n docNode = this._parseInheritDocTag(docInlineTagParsedParameters, embeddedTokenReader);\r\n break;\r\n case StandardTags.link.tagNameWithUpperCase:\r\n docNode = this._parseLinkTag(docInlineTagParsedParameters, embeddedTokenReader);\r\n break;\r\n default:\r\n docNode = new DocInlineTag(docInlineTagParsedParameters);\r\n }\r\n\r\n // Validate the tag\r\n const tagDefinition:\r\n | TSDocTagDefinition\r\n | undefined = this._parserContext.configuration.tryGetTagDefinitionWithUpperCase(tagNameWithUpperCase);\r\n\r\n this._validateTagDefinition(\r\n tagDefinition,\r\n tagName,\r\n /* expectingInlineTag */ true,\r\n tagNameExcerpt,\r\n docNode\r\n );\r\n\r\n return docNode;\r\n }\r\n\r\n private _parseInheritDocTag(\r\n docInlineTagParsedParameters: IDocInlineTagParsedParameters,\r\n embeddedTokenReader: TokenReader\r\n ): DocInlineTagBase {\r\n // If an error occurs, then return a generic DocInlineTag instead of DocInheritDocTag\r\n const errorTag: DocInlineTag = new DocInlineTag(docInlineTagParsedParameters);\r\n\r\n const parameters: IDocInheritDocTagParameters = {\r\n ...docInlineTagParsedParameters\r\n };\r\n\r\n if (embeddedTokenReader.peekTokenKind() !== TokenKind.EndOfInput) {\r\n parameters.declarationReference = this._parseDeclarationReference(\r\n embeddedTokenReader,\r\n docInlineTagParsedParameters.tagNameExcerpt,\r\n errorTag\r\n );\r\n if (!parameters.declarationReference) {\r\n return errorTag;\r\n }\r\n\r\n if (embeddedTokenReader.peekTokenKind() !== TokenKind.EndOfInput) {\r\n embeddedTokenReader.readToken();\r\n\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.InheritDocTagSyntax,\r\n 'Unexpected character after declaration reference',\r\n embeddedTokenReader.extractAccumulatedSequence(),\r\n errorTag\r\n );\r\n return errorTag;\r\n }\r\n }\r\n\r\n return new DocInheritDocTag(parameters);\r\n }\r\n\r\n private _parseLinkTag(\r\n docInlineTagParsedParameters: IDocInlineTagParsedParameters,\r\n embeddedTokenReader: TokenReader\r\n ): DocInlineTagBase {\r\n // If an error occurs, then return a generic DocInlineTag instead of DocInheritDocTag\r\n const errorTag: DocInlineTag = new DocInlineTag(docInlineTagParsedParameters);\r\n\r\n const parameters: IDocLinkTagParsedParameters = {\r\n ...docInlineTagParsedParameters\r\n };\r\n\r\n if (!docInlineTagParsedParameters.tagContentExcerpt) {\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.LinkTagEmpty,\r\n 'The @link tag content is missing',\r\n parameters.tagNameExcerpt,\r\n errorTag\r\n );\r\n\r\n return errorTag;\r\n }\r\n\r\n // Is the link destination a URL or a declaration reference?\r\n //\r\n // The JSDoc \"@link\" tag allows URLs, however supporting full URLs would be highly\r\n // ambiguous, for example \"microsoft.windows.camera:\" is an actual valid URI scheme,\r\n // and even the common \"mailto:example.com\" looks suspiciously like a declaration reference.\r\n // In practice JSDoc URLs are nearly always HTTP or HTTPS, so it seems fairly reasonable to\r\n // require the URL to have \"://\" and a scheme without any punctuation in it. If a more exotic\r\n // URL is needed, the HTML \"<a>\" tag can always be used.\r\n\r\n // We start with a fairly broad classifier heuristic, and then the parsers will refine this:\r\n // 1. Does it start with \"//\"?\r\n // 2. Does it contain \"://\"?\r\n\r\n let looksLikeUrl: boolean =\r\n embeddedTokenReader.peekTokenKind() === TokenKind.Slash &&\r\n embeddedTokenReader.peekTokenAfterKind() === TokenKind.Slash;\r\n const marker: number = embeddedTokenReader.createMarker();\r\n\r\n let done: boolean = looksLikeUrl;\r\n while (!done) {\r\n switch (embeddedTokenReader.peekTokenKind()) {\r\n // An URI scheme can contain letters, numbers, minus, plus, and periods\r\n case TokenKind.AsciiWord:\r\n case TokenKind.Period:\r\n case TokenKind.Hyphen:\r\n case TokenKind.Plus:\r\n embeddedTokenReader.readToken();\r\n break;\r\n case TokenKind.Colon:\r\n embeddedTokenReader.readToken();\r\n // Once we a reach a colon, then it's a URL only if we see \"://\"\r\n looksLikeUrl =\r\n embeddedTokenReader.peekTokenKind() === TokenKind.Slash &&\r\n embeddedTokenReader.peekTokenAfterKind() === TokenKind.Slash;\r\n done = true;\r\n break;\r\n default:\r\n done = true;\r\n }\r\n }\r\n\r\n embeddedTokenReader.backtrackToMarker(marker);\r\n\r\n // Is the hyperlink a URL or a declaration reference?\r\n if (looksLikeUrl) {\r\n // It starts with something like \"http://\", so parse it as a URL\r\n if (\r\n !this._parseLinkTagUrlDestination(\r\n embeddedTokenReader,\r\n parameters,\r\n docInlineTagParsedParameters.tagNameExcerpt,\r\n errorTag\r\n )\r\n ) {\r\n return errorTag;\r\n }\r\n } else {\r\n // Otherwise, assume it's a declaration reference\r\n if (\r\n !this._parseLinkTagCodeDestination(\r\n embeddedTokenReader,\r\n parameters,\r\n docInlineTagParsedParameters.tagNameExcerpt,\r\n errorTag\r\n )\r\n ) {\r\n return errorTag;\r\n }\r\n }\r\n\r\n if (embeddedTokenReader.peekTokenKind() === TokenKind.Spacing) {\r\n // The above parser rules should have consumed any spacing before the pipe\r\n throw new Error('Unconsumed spacing encountered after construct');\r\n }\r\n\r\n if (embeddedTokenReader.peekTokenKind() === TokenKind.Pipe) {\r\n // Read the link text\r\n embeddedTokenReader.readToken();\r\n parameters.pipeExcerpt = embeddedTokenReader.extractAccumulatedSequence();\r\n parameters.spacingAfterPipeExcerpt = this._tryReadSpacingAndNewlines(embeddedTokenReader);\r\n\r\n // Read everything until the end\r\n // NOTE: Because we're using an embedded TokenReader, the TokenKind.EndOfInput occurs\r\n // when we reach the \"}\", not the end of the original input\r\n done = false;\r\n let spacingAfterLinkTextMarker: number | undefined = undefined;\r\n while (!done) {\r\n switch (embeddedTokenReader.peekTokenKind()) {\r\n case TokenKind.EndOfInput:\r\n done = true;\r\n break;\r\n case TokenKind.Pipe:\r\n case TokenKind.LeftCurlyBracket:\r\n const badCharacter: string = embeddedTokenReader.readToken().toString();\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.LinkTagUnescapedText,\r\n `The \"${badCharacter}\" character may not be used in the link text without escaping it`,\r\n embeddedTokenReader.extractAccumulatedSequence(),\r\n errorTag\r\n );\r\n return errorTag;\r\n case TokenKind.Spacing:\r\n case TokenKind.Newline:\r\n embeddedTokenReader.readToken();\r\n break;\r\n default:\r\n // We found a non-spacing character, so move the spacingAfterLinkTextMarker\r\n spacingAfterLinkTextMarker = embeddedTokenReader.createMarker() + 1;\r\n embeddedTokenReader.readToken();\r\n }\r\n }\r\n\r\n const linkTextAndSpacing:\r\n | TokenSequence\r\n | undefined = embeddedTokenReader.tryExtractAccumulatedSequence();\r\n if (linkTextAndSpacing) {\r\n if (spacingAfterLinkTextMarker === undefined) {\r\n // We never found any non-spacing characters, so everything is trailing spacing\r\n parameters.spacingAfterLinkTextExcerpt = linkTextAndSpacing;\r\n } else if (spacingAfterLinkTextMarker >= linkTextAndSpacing.endIndex) {\r\n // We found no trailing spacing, so everything we found is the text\r\n parameters.linkTextExcerpt = linkTextAndSpacing;\r\n } else {\r\n // Split the trailing spacing from the link text\r\n parameters.linkTextExcerpt = linkTextAndSpacing.getNewSequence(\r\n linkTextAndSpacing.startIndex,\r\n spacingAfterLinkTextMarker\r\n );\r\n parameters.spacingAfterLinkTextExcerpt = linkTextAndSpacing.getNewSequence(\r\n spacingAfterLinkTextMarker,\r\n linkTextAndSpacing.endIndex\r\n );\r\n }\r\n }\r\n } else if (embeddedTokenReader.peekTokenKind() !== TokenKind.EndOfInput) {\r\n embeddedTokenReader.readToken();\r\n\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.LinkTagDestinationSyntax,\r\n 'Unexpected character after link destination',\r\n embeddedTokenReader.extractAccumulatedSequence(),\r\n errorTag\r\n );\r\n return errorTag;\r\n }\r\n\r\n return new DocLinkTag(parameters);\r\n }\r\n\r\n private _parseLinkTagUrlDestination(\r\n embeddedTokenReader: TokenReader,\r\n parameters: IDocLinkTagParsedParameters,\r\n tokenSequenceForErrorContext: TokenSequence,\r\n nodeForErrorContext: DocNode\r\n ): boolean {\r\n // Simply accumulate everything up to the next space. We won't try to implement a proper\r\n // URI parser here.\r\n let urlDestination: string = '';\r\n\r\n let done: boolean = false;\r\n while (!done) {\r\n switch (embeddedTokenReader.peekTokenKind()) {\r\n case TokenKind.Spacing:\r\n case TokenKind.Newline:\r\n case TokenKind.EndOfInput:\r\n case TokenKind.Pipe:\r\n case TokenKind.RightCurlyBracket:\r\n done = true;\r\n break;\r\n default:\r\n urlDestination += embeddedTokenReader.readToken();\r\n break;\r\n }\r\n }\r\n\r\n if (urlDestination.length === 0) {\r\n // This should be impossible since the caller ensures that peekTokenKind() === TokenKind.AsciiWord\r\n throw new Error('Missing URL in _parseLinkTagUrlDestination()');\r\n }\r\n\r\n const urlDestinationExcerpt: TokenSequence = embeddedTokenReader.extractAccumulatedSequence();\r\n\r\n const invalidUrlExplanation: string | undefined = StringChecks.explainIfInvalidLinkUrl(urlDestination);\r\n if (invalidUrlExplanation) {\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.LinkTagInvalidUrl,\r\n invalidUrlExplanation,\r\n urlDestinationExcerpt,\r\n nodeForErrorContext\r\n );\r\n return false;\r\n }\r\n\r\n parameters.urlDestinationExcerpt = urlDestinationExcerpt;\r\n parameters.spacingAfterDestinationExcerpt = this._tryReadSpacingAndNewlines(embeddedTokenReader);\r\n\r\n return true;\r\n }\r\n\r\n private _parseLinkTagCodeDestination(\r\n embeddedTokenReader: TokenReader,\r\n parameters: IDocLinkTagParameters,\r\n tokenSequenceForErrorContext: TokenSequence,\r\n nodeForErrorContext: DocNode\r\n ): boolean {\r\n parameters.codeDestination = this._parseDeclarationReference(\r\n embeddedTokenReader,\r\n tokenSequenceForErrorContext,\r\n nodeForErrorContext\r\n );\r\n\r\n return !!parameters.codeDestination;\r\n }\r\n\r\n private _parseDeclarationReference(\r\n tokenReader: TokenReader,\r\n tokenSequenceForErrorContext: TokenSequence,\r\n nodeForErrorContext: DocNode\r\n ): DocDeclarationReference | undefined {\r\n tokenReader.assertAccumulatedSequenceIsEmpty();\r\n\r\n // The package name can contain characters that look like a member reference. This means we need to scan forwards\r\n // to see if there is a \"#\". However, we need to be careful not to match a \"#\" that is part of a quoted expression.\r\n\r\n const marker: number = tokenReader.createMarker();\r\n let hasHash: boolean = false;\r\n\r\n // A common mistake is to forget the \"#\" for package name or import path. The telltale sign\r\n // of this is mistake is that we see path-only characters such as \"@\" or \"/\" in the beginning\r\n // where this would be a syntax error for a member reference.\r\n let lookingForImportCharacters: boolean = true;\r\n let sawImportCharacters: boolean = false;\r\n\r\n let done: boolean = false;\r\n while (!done) {\r\n switch (tokenReader.peekTokenKind()) {\r\n case TokenKind.DoubleQuote:\r\n case TokenKind.EndOfInput:\r\n case TokenKind.LeftCurlyBracket:\r\n case TokenKind.LeftParenthesis:\r\n case TokenKind.LeftSquareBracket:\r\n case TokenKind.Newline:\r\n case TokenKind.Pipe:\r\n case TokenKind.RightCurlyBracket:\r\n case TokenKind.RightParenthesis:\r\n case TokenKind.RightSquareBracket:\r\n case TokenKind.SingleQuote:\r\n case TokenKind.Spacing:\r\n done = true;\r\n break;\r\n case TokenKind.PoundSymbol:\r\n hasHash = true;\r\n done = true;\r\n break;\r\n case TokenKind.Slash:\r\n case TokenKind.AtSign:\r\n if (lookingForImportCharacters) {\r\n sawImportCharacters = true;\r\n }\r\n tokenReader.readToken();\r\n break;\r\n case TokenKind.AsciiWord:\r\n case TokenKind.Period:\r\n case TokenKind.Hyphen:\r\n // It's a character that looks like part of a package name or import path,\r\n // so don't set lookingForImportCharacters = false\r\n tokenReader.readToken();\r\n break;\r\n default:\r\n // Once we reach something other than AsciiWord and Period, then the meaning of\r\n // slashes and at-signs is no longer obvious.\r\n lookingForImportCharacters = false;\r\n\r\n tokenReader.readToken();\r\n }\r\n }\r\n\r\n if (!hasHash && sawImportCharacters) {\r\n // We saw characters that will be a syntax error if interpreted as a member reference,\r\n // but would make sense as a package name or import path, but we did not find a \"#\"\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.ReferenceMissingHash,\r\n 'The declaration reference appears to contain a package name or import path,' +\r\n ' but it is missing the \"#\" delimiter',\r\n tokenReader.extractAccumulatedSequence(),\r\n nodeForErrorContext\r\n );\r\n return undefined;\r\n }\r\n\r\n tokenReader.backtrackToMarker(marker);\r\n\r\n let packageNameExcerpt: TokenSequence | undefined;\r\n let importPathExcerpt: TokenSequence | undefined;\r\n let importHashExcerpt: TokenSequence | undefined;\r\n let spacingAfterImportHashExcerpt: TokenSequence | undefined;\r\n\r\n if (hasHash) {\r\n // If it starts with a \".\" then it's a relative path, not a package name\r\n if (tokenReader.peekTokenKind() !== TokenKind.Period) {\r\n // Read the package name:\r\n const scopedPackageName: boolean = tokenReader.peekTokenKind() === TokenKind.AtSign;\r\n let finishedScope: boolean = false;\r\n\r\n done = false;\r\n while (!done) {\r\n switch (tokenReader.peekTokenKind()) {\r\n case TokenKind.EndOfInput:\r\n // If hasHash=true, then we are expecting to stop when we reach the hash\r\n throw new Error('Expecting pound symbol');\r\n case TokenKind.Slash:\r\n // Stop at the first slash, unless this is a scoped package, in which case we stop at the second slash\r\n if (scopedPackageName && !finishedScope) {\r\n tokenReader.readToken();\r\n finishedScope = true;\r\n } else {\r\n done = true;\r\n }\r\n break;\r\n case TokenKind.PoundSymbol:\r\n done = true;\r\n break;\r\n default:\r\n tokenReader.readToken();\r\n }\r\n }\r\n\r\n if (!tokenReader.isAccumulatedSequenceEmpty()) {\r\n packageNameExcerpt = tokenReader.extractAccumulatedSequence();\r\n\r\n // Check that the packageName is syntactically valid\r\n const explanation: string | undefined = StringChecks.explainIfInvalidPackageName(\r\n packageNameExcerpt.toString()\r\n );\r\n if (explanation) {\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.ReferenceMalformedPackageName,\r\n explanation,\r\n packageNameExcerpt,\r\n nodeForErrorContext\r\n );\r\n return undefined;\r\n }\r\n }\r\n }\r\n\r\n // Read the import path:\r\n done = false;\r\n while (!done) {\r\n switch (tokenReader.peekTokenKind()) {\r\n case TokenKind.EndOfInput:\r\n // If hasHash=true, then we are expecting to stop when we reach the hash\r\n throw new Error('Expecting pound symbol');\r\n case TokenKind.PoundSymbol:\r\n done = true;\r\n break;\r\n default:\r\n tokenReader.readToken();\r\n }\r\n }\r\n\r\n if (!tokenReader.isAccumulatedSequenceEmpty()) {\r\n importPathExcerpt = tokenReader.extractAccumulatedSequence();\r\n\r\n // Check that the importPath is syntactically valid\r\n const explanation: string | undefined = StringChecks.explainIfInvalidImportPath(\r\n importPathExcerpt.toString(),\r\n !!packageNameExcerpt\r\n );\r\n if (explanation) {\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.ReferenceMalformedImportPath,\r\n explanation,\r\n importPathExcerpt,\r\n nodeForErrorContext\r\n );\r\n return undefined;\r\n }\r\n }\r\n\r\n // Read the import hash\r\n if (tokenReader.peekTokenKind() !== TokenKind.PoundSymbol) {\r\n // The above logic should have left us at the PoundSymbol\r\n throw new Error('Expecting pound symbol');\r\n }\r\n tokenReader.readToken();\r\n importHashExcerpt = tokenReader.extractAccumulatedSequence();\r\n\r\n spacingAfterImportHashExcerpt = this._tryReadSpacingAndNewlines(tokenReader);\r\n\r\n if (packageNameExcerpt === undefined && importPathExcerpt === undefined) {\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.ReferenceHashSyntax,\r\n 'The hash character must be preceded by a package name or import path',\r\n importHashExcerpt,\r\n nodeForErrorContext\r\n );\r\n return undefined;\r\n }\r\n }\r\n\r\n // Read the member references:\r\n const memberReferences: DocMemberReference[] = [];\r\n\r\n done = false;\r\n while (!done) {\r\n switch (tokenReader.peekTokenKind()) {\r\n case TokenKind.Period:\r\n case TokenKind.LeftParenthesis:\r\n case TokenKind.AsciiWord:\r\n case TokenKind.Colon:\r\n case TokenKind.LeftSquareBracket:\r\n case TokenKind.DoubleQuote:\r\n const expectingDot: boolean = memberReferences.length > 0;\r\n const memberReference: DocMemberReference | undefined = this._parseMemberReference(\r\n tokenReader,\r\n expectingDot,\r\n tokenSequenceForErrorContext,\r\n nodeForErrorContext\r\n );\r\n\r\n if (!memberReference) {\r\n return undefined;\r\n }\r\n\r\n memberReferences.push(memberReference);\r\n break;\r\n default:\r\n done = true;\r\n }\r\n }\r\n\r\n if (\r\n packageNameExcerpt === undefined &&\r\n importPathExcerpt === undefined &&\r\n memberReferences.length === 0\r\n ) {\r\n // We didn't find any parts of a declaration reference\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.MissingReference,\r\n 'Expecting a declaration reference',\r\n tokenSequenceForErrorContext,\r\n nodeForErrorContext\r\n );\r\n return undefined;\r\n }\r\n\r\n return new DocDeclarationReference({\r\n parsed: true,\r\n configuration: this._configuration,\r\n\r\n packageNameExcerpt,\r\n importPathExcerpt,\r\n\r\n importHashExcerpt,\r\n spacingAfterImportHashExcerpt,\r\n\r\n memberReferences\r\n });\r\n }\r\n\r\n private _parseMemberReference(\r\n tokenReader: TokenReader,\r\n expectingDot: boolean,\r\n tokenSequenceForErrorContext: TokenSequence,\r\n nodeForErrorContext: DocNode\r\n ): DocMemberReference | undefined {\r\n const parameters: IDocMemberReferenceParsedParameters = {\r\n parsed: true,\r\n configuration: this._configuration\r\n };\r\n\r\n // Read the dot operator\r\n if (expectingDot) {\r\n if (tokenReader.peekTokenKind() !== TokenKind.Period) {\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.ReferenceMissingDot,\r\n 'Expecting a period before the next component of a declaration reference',\r\n tokenSequenceForErrorContext,\r\n nodeForErrorContext\r\n );\r\n return undefined;\r\n }\r\n tokenReader.readToken();\r\n parameters.dotExcerpt = tokenReader.extractAccumulatedSequence();\r\n\r\n parameters.spacingAfterDotExcerpt = this._tryReadSpacingAndNewlines(tokenReader);\r\n }\r\n\r\n // Read the left parenthesis if there is one\r\n if (tokenReader.peekTokenKind() === TokenKind.LeftParenthesis) {\r\n tokenReader.readToken();\r\n parameters.leftParenthesisExcerpt = tokenReader.extractAccumulatedSequence();\r\n\r\n parameters.spacingAfterLeftParenthesisExcerpt = this._tryReadSpacingAndNewlines(tokenReader);\r\n }\r\n\r\n // Read the member identifier or symbol\r\n if (tokenReader.peekTokenKind() === TokenKind.LeftSquareBracket) {\r\n parameters.memberSymbol = this._parseMemberSymbol(tokenReader, nodeForErrorContext);\r\n if (!parameters.memberSymbol) {\r\n return undefined;\r\n }\r\n } else {\r\n parameters.memberIdentifier = this._parseMemberIdentifier(\r\n tokenReader,\r\n tokenSequenceForErrorContext,\r\n nodeForErrorContext\r\n );\r\n\r\n if (!parameters.memberIdentifier) {\r\n return undefined;\r\n }\r\n }\r\n parameters.spacingAfterMemberExcerpt = this._tryReadSpacingAndNewlines(tokenReader);\r\n\r\n // Read the colon\r\n if (tokenReader.peekTokenKind() === TokenKind.Colon) {\r\n tokenReader.readToken();\r\n\r\n parameters.colonExcerpt = tokenReader.extractAccumulatedSequence();\r\n\r\n parameters.spacingAfterColonExcerpt = this._tryReadSpacingAndNewlines(tokenReader);\r\n\r\n if (!parameters.leftParenthesisExcerpt) {\r\n // In the current TSDoc draft standard, a member reference with a selector requires the parentheses.\r\n // It would be reasonable to make the parentheses optional, and we are contemplating simplifying the\r\n // notation in the future. But for now the parentheses are required.\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.ReferenceSelectorMissingParens,\r\n 'Syntax error in declaration reference: the member selector must be enclosed in parentheses',\r\n parameters.colonExcerpt,\r\n nodeForErrorContext\r\n );\r\n return undefined;\r\n }\r\n\r\n // If there is a colon, then read the selector\r\n parameters.selector = this._parseMemberSelector(\r\n tokenReader,\r\n parameters.colonExcerpt,\r\n nodeForErrorContext\r\n );\r\n if (!parameters.selector) {\r\n return undefined;\r\n }\r\n\r\n parameters.spacingAfterSelectorExcerpt = this._tryReadSpacingAndNewlines(tokenReader);\r\n } else {\r\n if (parameters.leftParenthesisExcerpt) {\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.ReferenceMissingColon,\r\n 'Expecting a colon after the identifier because the expression is in parentheses',\r\n parameters.leftParenthesisExcerpt,\r\n nodeForErrorContext\r\n );\r\n return undefined;\r\n }\r\n }\r\n\r\n // Read the right parenthesis\r\n if (parameters.leftParenthesisExcerpt) {\r\n if (tokenReader.peekTokenKind() !== TokenKind.RightParenthesis) {\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.ReferenceMissingRightParen,\r\n 'Expecting a matching right parenthesis',\r\n parameters.leftParenthesisExcerpt,\r\n nodeForErrorContext\r\n );\r\n return undefined;\r\n }\r\n\r\n tokenReader.readToken();\r\n\r\n parameters.rightParenthesisExcerpt = tokenReader.extractAccumulatedSequence();\r\n\r\n parameters.spacingAfterRightParenthesisExcerpt = this._tryReadSpacingAndNewlines(tokenReader);\r\n }\r\n\r\n return new DocMemberReference(parameters);\r\n }\r\n\r\n private _parseMemberSymbol(\r\n tokenReader: TokenReader,\r\n nodeForErrorContext: DocNode\r\n ): DocMemberSymbol | undefined {\r\n // Read the \"[\"\r\n if (tokenReader.peekTokenKind() !== TokenKind.LeftSquareBracket) {\r\n // This should be impossible since the caller ensures that peekTokenKind() === TokenKind.LeftSquareBracket\r\n throw new Error('Expecting \"[\"');\r\n }\r\n\r\n tokenReader.readToken();\r\n const leftBracketExcerpt: TokenSequence = tokenReader.extractAccumulatedSequence();\r\n\r\n const spacingAfterLeftBracketExcerpt: TokenSequence | undefined = this._tryReadSpacingAndNewlines(\r\n tokenReader\r\n );\r\n\r\n // Read the declaration reference\r\n const declarationReference: DocDeclarationReference | undefined = this._parseDeclarationReference(\r\n tokenReader,\r\n leftBracketExcerpt,\r\n nodeForErrorContext\r\n );\r\n\r\n if (!declarationReference) {\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.ReferenceSymbolSyntax,\r\n 'Missing declaration reference in symbol reference',\r\n leftBracketExcerpt,\r\n nodeForErrorContext\r\n );\r\n\r\n return undefined;\r\n }\r\n\r\n // (We don't need to worry about spacing here since _parseDeclarationReference() absorbs trailing spaces)\r\n\r\n // Read the \"]\"\r\n if (tokenReader.peekTokenKind() !== TokenKind.RightSquareBracket) {\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.ReferenceMissingRightBracket,\r\n 'Missing closing square bracket for symbol reference',\r\n leftBracketExcerpt,\r\n nodeForErrorContext\r\n );\r\n\r\n return undefined;\r\n }\r\n\r\n tokenReader.readToken();\r\n const rightBracketExcerpt: TokenSequence = tokenReader.extractAccumulatedSequence();\r\n\r\n return new DocMemberSymbol({\r\n parsed: true,\r\n configuration: this._configuration,\r\n\r\n leftBracketExcerpt,\r\n spacingAfterLeftBracketExcerpt,\r\n symbolReference: declarationReference,\r\n rightBracketExcerpt\r\n });\r\n }\r\n\r\n private _parseMemberIdentifier(\r\n tokenReader: TokenReader,\r\n tokenSequenceForErrorContext: TokenSequence,\r\n nodeForErrorContext: DocNode\r\n ): DocMemberIdentifier | undefined {\r\n let leftQuoteExcerpt: TokenSequence | undefined = undefined;\r\n let rightQuoteExcerpt: TokenSequence | undefined = undefined;\r\n\r\n // Is this a quoted identifier?\r\n if (tokenReader.peekTokenKind() === TokenKind.DoubleQuote) {\r\n // Read the opening '\"'\r\n tokenReader.readToken();\r\n leftQuoteExcerpt = tokenReader.extractAccumulatedSequence();\r\n\r\n // Read the text inside the quotes\r\n while (tokenReader.peekTokenKind() !== TokenKind.DoubleQuote) {\r\n if (tokenReader.peekTokenKind() === TokenKind.EndOfInput) {\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.ReferenceMissingQuote,\r\n 'Unexpected end of input inside quoted member identifier',\r\n leftQuoteExcerpt,\r\n nodeForErrorContext\r\n );\r\n return undefined;\r\n }\r\n\r\n tokenReader.readToken();\r\n }\r\n\r\n if (tokenReader.isAccumulatedSequenceEmpty()) {\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.ReferenceEmptyIdentifier,\r\n 'The quoted identifier cannot be empty',\r\n leftQuoteExcerpt,\r\n nodeForErrorContext\r\n );\r\n return undefined;\r\n }\r\n\r\n const identifierExcerpt: TokenSequence = tokenReader.extractAccumulatedSequence();\r\n\r\n // Read the closing '\"\"\r\n tokenReader.readToken(); // read the quote\r\n rightQuoteExcerpt = tokenReader.extractAccumulatedSequence();\r\n\r\n return new DocMemberIdentifier({\r\n parsed: true,\r\n configuration: this._configuration,\r\n\r\n leftQuoteExcerpt,\r\n identifierExcerpt,\r\n rightQuoteExcerpt\r\n });\r\n } else {\r\n // Otherwise assume it's a valid TypeScript identifier\r\n\r\n let done: boolean = false;\r\n while (!done) {\r\n switch (tokenReader.peekTokenKind()) {\r\n case TokenKind.AsciiWord:\r\n case TokenKind.DollarSign:\r\n tokenReader.readToken();\r\n break;\r\n default:\r\n done = true;\r\n break;\r\n }\r\n }\r\n\r\n if (tokenReader.isAccumulatedSequenceEmpty()) {\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.ReferenceMissingIdentifier,\r\n 'Syntax error in declaration reference: expecting a member identifier',\r\n tokenSequenceForErrorContext,\r\n nodeForErrorContext\r\n );\r\n return undefined;\r\n }\r\n\r\n const identifierExcerpt: TokenSequence = tokenReader.extractAccumulatedSequence();\r\n const identifier: string = identifierExcerpt.toString();\r\n\r\n const explanation: string | undefined = StringChecks.explainIfInvalidUnquotedMemberIdentifier(\r\n identifier\r\n );\r\n if (explanation) {\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.ReferenceUnquotedIdentifier,\r\n explanation,\r\n identifierExcerpt,\r\n nodeForErrorContext\r\n );\r\n return undefined;\r\n }\r\n\r\n return new DocMemberIdentifier({\r\n parsed: true,\r\n configuration: this._configuration,\r\n\r\n leftQuoteExcerpt,\r\n identifierExcerpt,\r\n rightQuoteExcerpt\r\n });\r\n }\r\n }\r\n\r\n private _parseMemberSelector(\r\n tokenReader: TokenReader,\r\n tokenSequenceForErrorContext: TokenSequence,\r\n nodeForErrorContext: DocNode\r\n ): DocMemberSelector | undefined {\r\n if (tokenReader.peekTokenKind() !== TokenKind.AsciiWord) {\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.ReferenceMissingLabel,\r\n 'Expecting a selector label after the colon',\r\n tokenSequenceForErrorContext,\r\n nodeForErrorContext\r\n );\r\n }\r\n\r\n const selector: string = tokenReader.readToken().toString();\r\n const selectorExcerpt: TokenSequence = tokenReader.extractAccumulatedSequence();\r\n\r\n const docMemberSelector: DocMemberSelector = new DocMemberSelector({\r\n parsed: true,\r\n configuration: this._configuration,\r\n\r\n selectorExcerpt,\r\n selector\r\n });\r\n\r\n if (docMemberSelector.errorMessage) {\r\n this._parserContext.log.addMessageForTokenSequence(\r\n TSDocMessageId.ReferenceSelectorSyntax,\r\n docMemberSelector.errorMessage,\r\n selectorExcerpt,\r\n nodeForErrorContext\r\n );\r\n return undefined;\r\n }\r\n\r\n return docMemberSelector;\r\n }\r\n\r\n private _parseHtmlStartTag(tokenReader: TokenReader): DocNode {\r\n tokenReader.assertAccumulatedSequenceIsEmpty();\r\n const marker: number = tokenReader.createMarker();\r\n\r\n // Read the \"<\" delimiter\r\n const lessThanToken: Token = tokenReader.readToken();\r\n if (lessThanToken.kind !== TokenKind.LessThan) {\r\n // This would be a parser bug -- the caller of _parseHtmlStartTag() should have verified this while\r\n // looking ahead\r\n throw new Error('Expecting an HTML tag starting with \"<\"');\r\n }\r\n\r\n // NOTE: CommonMark does not permit whitespace after the \"<\"\r\n\r\n const openingDelimiterExcerpt: TokenSequence = tokenReader.extractAccumulatedSequence();\r\n\r\n // Read the element name\r\n const nameExcerpt: ResultOrFailure<TokenSequence> = this._parseHtmlName(tokenReader);\r\n if (isFailure(nameExcerpt)) {\r\n return this._backtrackAndCreateErrorForFailure(\r\n tokenReader,\r\n marker,\r\n 'Invalid HTML element: ',\r\n nameExcerpt\r\n );\r\n }\r\n\r\n const spacingAfterNameExcerpt: TokenSequence | undefined = this._tryReadSpacingAndNewlines(tokenReader);\r\n\r\n const htmlAttributes: DocHtmlAttribute[] = [];\r\n\r\n // Read the attributes until we see a \">\" or \"/>\"\r\n while (tokenReader.peekTokenKind() === TokenKind.AsciiWord) {\r\n // Read the attribute\r\n const attributeNode: ResultOrFailure<DocHtmlAttribute> = this._parseHtmlAttribute(tokenReader);\r\n if (isFailure(attributeNode)) {\r\n return this._backtrackAndCreateErrorForFailure(\r\n tokenReader,\r\n marker,\r\n 'The HTML element has an invalid attribute: ',\r\n attributeNode\r\n );\r\n }\r\n\r\n htmlAttributes.push(attributeNode);\r\n }\r\n\r\n // Read the closing \"/>\" or \">\" as the Excerpt.suffix\r\n tokenReader.assertAccumulatedSequenceIsEmpty();\r\n const endDelimiterMarker: number = tokenReader.createMarker();\r\n\r\n let selfClosingTag: boolean = false;\r\n if (tokenReader.peekTokenKind() === TokenKind.Slash) {\r\n tokenReader.readToken();\r\n selfClosingTag = true;\r\n }\r\n if (tokenReader.peekTokenKind() !== TokenKind.GreaterThan) {\r\n const failure: IFailure = this._createFailureForTokensSince(\r\n tokenReader,\r\n TSDocMessageId.HtmlTagMissingGreaterThan,\r\n 'Expecting an attribute or \">\" or \"/>\"',\r\n endDelimiterMarker\r\n );\r\n return this._backtrackAndCreateErrorForFailure(\r\n tokenReader,\r\n marker,\r\n 'The HTML tag has invalid syntax: ',\r\n failure\r\n );\r\n }\r\n tokenReader.readToken();\r\n\r\n const closingDelimiterExcerpt: TokenSequence = tokenReader.extractAccumulatedSequence();\r\n\r\n // NOTE: We don't read excerptParameters.separator here, since if there is any it\r\n // will be represented as DocPlainText.\r\n\r\n return new DocHtmlStartTag({\r\n parsed: true,\r\n configuration: this._configuration,\r\n\r\n openingDelimiterExcerpt,\r\n\r\n nameExcerpt,\r\n spacingAfterNameExcerpt,\r\n\r\n htmlAttributes,\r\n\r\n selfClosingTag,\r\n\r\n closingDelimiterExcerpt\r\n });\r\n }\r\n\r\n private _parseHtmlAttribute(tokenReader: TokenReader): ResultOrFailure<DocHtmlAttribute> {\r\n tokenReader.assertAccumulatedSequenceIsEmpty();\r\n\r\n // Read the attribute name\r\n const nameExcerpt: ResultOrFailure<TokenSequence> = this._parseHtmlName(tokenReader);\r\n if (isFailure(nameExcerpt)) {\r\n return nameExcerpt;\r\n }\r\n\r\n const spacingAfterNameExcerpt: TokenSequence | undefined = this._tryReadSpacingAndNewlines(tokenReader);\r\n\r\n // Read the equals\r\n if (tokenReader.peekTokenKind() !== TokenKind.Equals) {\r\n return this._createFailureForToken(\r\n tokenReader,\r\n TSDocMessageId.HtmlTagMissingEquals,\r\n 'Expecting \"=\" after HTML attribute name'\r\n );\r\n }\r\n tokenReader.readToken();\r\n\r\n const equalsExcerpt: TokenSequence = tokenReader.extractAccumulatedSequence();\r\n\r\n const spacingAfterEqualsExcerpt: TokenSequence | undefined = this._tryReadSpacingAndNewlines(tokenReader);\r\n\r\n // Read the attribute value\r\n const attributeValue: ResultOrFailure<string> = this._parseHtmlString(tokenReader);\r\n if (isFailure(attributeValue)) {\r\n return attributeValue;\r\n }\r\n\r\n const valueExcerpt: TokenSequence = tokenReader.extractAccumulatedSequence();\r\n\r\n const spacingAfterValueExcerpt: TokenSequence | undefined = this._tryReadSpacingAndNewlines(tokenReader);\r\n\r\n return new DocHtmlAttribute({\r\n parsed: true,\r\n configuration: this._configuration,\r\n\r\n nameExcerpt,\r\n spacingAfterNameExcerpt,\r\n\r\n equalsExcerpt,\r\n spacingAfterEqualsExcerpt,\r\n\r\n valueExcerpt,\r\n spacingAfterValueExcerpt\r\n });\r\n }\r\n\r\n private _parseHtmlString(tokenReader: TokenReader): ResultOrFailure<string> {\r\n const marker: number = tokenReader.createMarker();\r\n const quoteTokenKind: TokenKind = tokenReader.peekTokenKind();\r\n if (quoteTokenKind !== TokenKind.DoubleQuote && quoteTokenKind !== TokenKind.SingleQuote) {\r\n return this._createFailureForToken(\r\n tokenReader,\r\n TSDocMessageId.HtmlTagMissingString,\r\n 'Expecting an HTML string starting with a single-quote or double-quote character'\r\n );\r\n }\r\n tokenReader.readToken();\r\n\r\n let textWithoutQuotes: string = '';\r\n\r\n for (;;) {\r\n const peekedTokenKind: TokenKind = tokenReader.peekTokenKind();\r\n // Did we find the matching token?\r\n if (peekedTokenKind === quoteTokenKind) {\r\n tokenReader.readToken(); // extract the quote\r\n break;\r\n }\r\n if (peekedTokenKind === TokenKind.EndOfInput || peekedTokenKind === TokenKind.Newline) {\r\n return this._createFailureForToken(\r\n tokenReader,\r\n TSDocMessageId.HtmlStringMissingQuote,\r\n 'The HTML string is missing its closing quote',\r\n marker\r\n );\r\n }\r\n textWithoutQuotes += tokenReader.readToken().toString();\r\n }\r\n\r\n // The next attribute cannot start immediately after this one\r\n if (tokenReader.peekTokenKind() === TokenKind.AsciiWord) {\r\n return this._createFailureForToken(\r\n tokenReader,\r\n TSDocMessageId.TextAfterHtmlString,\r\n 'The next character after a closing quote must be spacing or punctuation'\r\n );\r\n }\r\n\r\n return textWithoutQuotes;\r\n }\r\n\r\n private _parseHtmlEndTag(tokenReader: TokenReader): DocNode {\r\n tokenReader.assertAccumulatedSequenceIsEmpty();\r\n const marker: number = tokenReader.createMarker();\r\n\r\n // Read the \"</\" delimiter\r\n const lessThanToken: Token = tokenReader.peekToken();\r\n if (lessThanToken.kind !== TokenKind.LessThan) {\r\n return this._backtrackAndCreateError(\r\n tokenReader,\r\n marker,\r\n TSDocMessageId.MissingHtmlEndTag,\r\n 'Expecting an HTML tag starting with \"</\"'\r\n );\r\n }\r\n tokenReader.readToken();\r\n\r\n const slashToken: Token = tokenReader.peekToken();\r\n if (slashToken.kind !== TokenKind.Slash) {\r\n return this._backtrackAndCreateError(\r\n tokenReader,\r\n marker,\r\n TSDocMessageId.MissingHtmlEndTag,\r\n 'Expecting an HTML tag starting with \"</\"'\r\n );\r\n }\r\n tokenReader.readToken();\r\n\r\n // NOTE: Spaces are not permitted here\r\n // https://www.w3.org/TR/html5/syntax.html#end-tags\r\n\r\n const openingDelimiterExcerpt: TokenSequence = tokenReader.extractAccumulatedSequence();\r\n\r\n // Read the tag name\r\n const nameExcerpt: ResultOrFailure<TokenSequence> = this._parseHtmlName(tokenReader);\r\n if (isFailure(nameExcerpt)) {\r\n return this._backtrackAndCreateErrorForFailure(\r\n tokenReader,\r\n marker,\r\n 'Expecting an HTML element name: ',\r\n nameExcerpt\r\n );\r\n }\r\n\r\n const spacingAfterNameExcerpt: TokenSequence | undefined = this._tryReadSpacingAndNewlines(tokenReader);\r\n\r\n // Read the closing \">\"\r\n if (tokenReader.peekTokenKind() !== TokenKind.GreaterThan) {\r\n const failure: IFailure = this._createFailureForToken(\r\n tokenReader,\r\n TSDocMessageId.HtmlTagMissingGreaterThan,\r\n 'Expecting a closing \">\" for the HTML tag'\r\n );\r\n return this._backtrackAndCreateErrorForFailure(tokenReader, marker, '', failure);\r\n }\r\n tokenReader.readToken();\r\n\r\n const closingDelimiterExcerpt: TokenSequence = tokenReader.extractAccumulatedSequence();\r\n\r\n return new DocHtmlEndTag({\r\n parsed: true,\r\n configuration: this._configuration,\r\n\r\n openingDelimiterExcerpt,\r\n\r\n nameExcerpt,\r\n spacingAfterNameExcerpt,\r\n\r\n closingDelimiterExcerpt\r\n });\r\n }\r\n\r\n /**\r\n * Parses an HTML name such as an element name or attribute name.\r\n */\r\n private _parseHtmlName(tokenReader: TokenReader): ResultOrFailure<TokenSequence> {\r\n const marker: number = tokenReader.createMarker();\r\n\r\n if (tokenReader.peekTokenKind() === TokenKind.Spacing) {\r\n return this._createFailureForTokensSince(\r\n tokenReader,\r\n TSDocMessageId.MalformedHtmlName,\r\n 'A space is not allowed here',\r\n marker\r\n );\r\n }\r\n\r\n let done: boolean = false;\r\n while (!done) {\r\n switch (tokenReader.peekTokenKind()) {\r\n case TokenKind.Hyphen:\r\n case TokenKind.Period:\r\n case TokenKind.AsciiWord:\r\n tokenReader.readToken();\r\n break;\r\n default:\r\n done = true;\r\n break;\r\n }\r\n }\r\n const excerpt: TokenSequence | undefined = tokenReader.tryExtractAccumulatedSequence();\r\n\r\n if (!excerpt) {\r\n return this._createFailureForToken(\r\n tokenReader,\r\n TSDocMessageId.MalformedHtmlName,\r\n 'Expecting an HTML name'\r\n );\r\n }\r\n\r\n const htmlName: string = excerpt.toString();\r\n\r\n const explanation: string | undefined = StringChecks.explainIfInvalidHtmlName(htmlName);\r\n\r\n if (explanation) {\r\n return this._createFailureForTokensSince(\r\n tokenReader,\r\n TSDocMessageId.MalformedHtmlName,\r\n explanation,\r\n marker\r\n );\r\n }\r\n\r\n if (\r\n this._configuration.validation.reportUnsupportedHtmlElements &&\r\n !this._configuration.isHtmlElementSupported(htmlName)\r\n ) {\r\n return this._createFailureForToken(\r\n tokenReader,\r\n TSDocMessageId.UnsupportedHtmlElementName,\r\n `The HTML element name ${JSON.stringify(htmlName)} is not defined by your TSDoc configuration`,\r\n marker\r\n );\r\n }\r\n\r\n return excerpt;\r\n }\r\n\r\n private _parseFencedCode(tokenReader: TokenReader): DocNode {\r\n tokenReader.assertAccumulatedSequenceIsEmpty();\r\n\r\n const startMarker: number = tokenReader.createMarker();\r\n const endOfOpeningDelimiterMarker: number = startMarker + 2;\r\n\r\n switch (tokenReader.peekPreviousTokenKind()) {\r\n case TokenKind.Newline:\r\n case TokenKind.EndOfInput:\r\n break;\r\n default:\r\n return this._backtrackAndCreateErrorRange(\r\n tokenReader,\r\n startMarker,\r\n // include the three backticks so they don't get reinterpreted as a code span\r\n endOfOpeningDelimiterMarker,\r\n TSDocMessageId.CodeFenceOpeningIndent,\r\n 'The opening backtick for a code fence must appear at the start of the line'\r\n );\r\n }\r\n\r\n // Read the opening ``` delimiter\r\n let openingDelimiter: string = '';\r\n openingDelimiter += tokenReader.readToken();\r\n openingDelimiter += tokenReader.readToken();\r\n openingDelimiter += tokenReader.readToken();\r\n\r\n if (openingDelimiter !== '```') {\r\n // This would be a parser bug -- the caller of _parseFencedCode() should have verified this while\r\n // looking ahead to distinguish code spans/fences\r\n throw new Error('Expecting three backticks');\r\n }\r\n\r\n const openingFenceExcerpt: TokenSequence = tokenReader.extractAccumulatedSequence();\r\n\r\n // Read any spaces after the delimiter,\r\n // but NOT the Newline since that goes with the spacingAfterLanguageExcerpt\r\n while (tokenReader.peekTokenKind() === TokenKind.Spacing) {\r\n tokenReader.readToken();\r\n }\r\n\r\n const spacingAfterOpeningFenceExcerpt:\r\n | TokenSequence\r\n | undefined = tokenReader.tryExtractAccumulatedSequence();\r\n\r\n // Read the language specifier (if present) and newline\r\n let done: boolean = false;\r\n let startOfPaddingMarker: number | undefined = undefined;\r\n while (!done) {\r\n switch (tokenReader.peekTokenKind()) {\r\n case TokenKind.Spacing:\r\n case TokenKind.Newline:\r\n if (startOfPaddingMarker === undefined) {\r\n // Starting a new run of spacing characters\r\n startOfPaddingMarker = tokenReader.createMarker();\r\n }\r\n if (tokenReader.peekTokenKind() === TokenKind.Newline) {\r\n done = true;\r\n }\r\n tokenReader.readToken();\r\n break;\r\n case TokenKind.Backtick:\r\n const failure: IFailure = this._createFailureForToken(\r\n tokenReader,\r\n TSDocMessageId.CodeFenceSpecifierSyntax,\r\n 'The language specifier cannot contain backtick characters'\r\n );\r\n return this._backtrackAndCreateErrorRangeForFailure(\r\n tokenReader,\r\n startMarker,\r\n endOfOpeningDelimiterMarker,\r\n 'Error parsing code fence: ',\r\n failure\r\n );\r\n case TokenKind.EndOfInput:\r\n const failure2: IFailure = this._createFailureForToken(\r\n tokenReader,\r\n TSDocMessageId.CodeFenceMissingDelimiter,\r\n 'Missing closing delimiter'\r\n );\r\n return this._backtrackAndCreateErrorRangeForFailure(\r\n tokenReader,\r\n startMarker,\r\n endOfOpeningDelimiterMarker,\r\n 'Error parsing code fence: ',\r\n failure2\r\n );\r\n default:\r\n // more non-spacing content\r\n startOfPaddingMarker = undefined;\r\n tokenReader.readToken();\r\n break;\r\n }\r\n }\r\n\r\n // At this point, we must have accumulated at least a newline token.\r\n // Example: \"pov-ray sdl \\n\"\r\n const restOfLineExcerpt: TokenSequence = tokenReader.extractAccumulatedSequence();\r\n\r\n // Example: \"pov-ray sdl\"\r\n const languageExcerpt: TokenSequence = restOfLineExcerpt.getNewSequence(\r\n restOfLineExcerpt.startIndex,\r\n startOfPaddingMarker!\r\n );\r\n\r\n // Example: \" \\n\"\r\n const spacingAfterLanguageExcerpt: TokenSequence | undefined = restOfLineExcerpt.getNewSequence(\r\n startOfPaddingMarker!,\r\n restOfLineExcerpt.endIndex\r\n );\r\n\r\n // Read the code content until we see the closing ``` delimiter\r\n let codeEndMarker: number = -1;\r\n let closingFenceStartMarker: number = -1;\r\n done = false;\r\n let tokenBeforeDelimiter: Token;\r\n while (!done) {\r\n switch (tokenReader.peekTokenKind()) {\r\n case TokenKind.EndOfInput:\r\n const failure2: IFailure = this._createFailureForToken(\r\n tokenReader,\r\n TSDocMessageId.CodeFenceMissingDelimiter,\r\n 'Missing closing delimiter'\r\n );\r\n return this._backtrackAndCreateErrorRangeForFailure(\r\n tokenReader,\r\n startMarker,\r\n endOfOpeningDelimiterMarker,\r\n 'Error parsing code fence: ',\r\n failure2\r\n );\r\n case TokenKind.Newline:\r\n tokenBeforeDelimiter = tokenReader.readToken();\r\n codeEndMarker = tokenReader.createMarker();\r\n\r\n while (tokenReader.peekTokenKind() === TokenKind.Spacing) {\r\n tokenBeforeDelimiter = tokenReader.readToken();\r\n }\r\n\r\n if (tokenReader.peekTokenKind() !== TokenKind.Backtick) {\r\n break;\r\n }\r\n closingFenceStartMarker = tokenReader.createMarker();\r\n tokenReader.readToken(); // first backtick\r\n\r\n if (tokenReader.peekTokenKind() !== TokenKind.Backtick) {\r\n break;\r\n }\r\n tokenReader.readToken(); // second backtick\r\n\r\n if (tokenReader.peekTokenKind() !== TokenKind.Backtick) {\r\n break;\r\n }\r\n tokenReader.readToken(); // third backtick\r\n\r\n done = true;\r\n break;\r\n default:\r\n tokenReader.readToken();\r\n break;\r\n }\r\n }\r\n\r\n if (tokenBeforeDelimiter!.kind !== TokenKind.Newline) {\r\n this._parserContext.log.addMessageForTextRange(\r\n TSDocMessageId.CodeFenceClosingIndent,\r\n 'The closing delimiter for a code fence must not be indented',\r\n tokenBeforeDelimiter!.range\r\n );\r\n }\r\n\r\n // Example: \"code 1\\ncode 2\\n ```\"\r\n const codeAndDelimiterExcerpt: TokenSequence = tokenReader.extractAccumulatedSequence();\r\n\r\n // Example: \"code 1\\ncode 2\\n\"\r\n const codeExcerpt: TokenSequence = codeAndDelimiterExcerpt.getNewSequence(\r\n codeAndDelimiterExcerpt.startIndex,\r\n codeEndMarker\r\n );\r\n\r\n // Example: \" \"\r\n const spacingBeforeClosingFenceExcerpt:\r\n | TokenSequence\r\n | undefined = codeAndDelimiterExcerpt.getNewSequence(codeEndMarker, closingFenceStartMarker);\r\n\r\n // Example: \"```\"\r\n const closingFenceExcerpt: TokenSequence = codeAndDelimiterExcerpt.getNewSequence(\r\n closingFenceStartMarker,\r\n codeAndDelimiterExcerpt.endIndex\r\n );\r\n\r\n // Read the spacing and newline after the closing delimiter\r\n done = false;\r\n while (!done) {\r\n switch (tokenReader.peekTokenKind()) {\r\n case TokenKind.Spacing:\r\n tokenReader.readToken();\r\n break;\r\n case TokenKind.Newline:\r\n done = true;\r\n tokenReader.readToken();\r\n break;\r\n case TokenKind.EndOfInput:\r\n done = true;\r\n break;\r\n default:\r\n this._parserContext.log.addMessageForTextRange(\r\n TSDocMessageId.CodeFenceClosingSyntax,\r\n 'Unexpected characters after closing delimiter for code fence',\r\n tokenReader.peekToken().range\r\n );\r\n done = true;\r\n break;\r\n }\r\n }\r\n\r\n // Example: \" \\n\"\r\n const spacingAfterClosingFenceExcerpt:\r\n | TokenSequence\r\n | undefined = tokenReader.tryExtractAccumulatedSequence();\r\n\r\n return new DocFencedCode({\r\n parsed: true,\r\n configuration: this._configuration,\r\n\r\n openingFenceExcerpt,\r\n spacingAfterOpeningFenceExcerpt,\r\n\r\n languageExcerpt,\r\n spacingAfterLanguageExcerpt,\r\n\r\n codeExcerpt,\r\n\r\n spacingBeforeClosingFenceExcerpt,\r\n closingFenceExcerpt,\r\n spacingAfterClosingFenceExcerpt\r\n });\r\n }\r\n\r\n private _parseCodeSpan(tokenReader: TokenReader): DocNode {\r\n tokenReader.assertAccumulatedSequenceIsEmpty();\r\n const marker: number = tokenReader.createMarker();\r\n\r\n // Parse the opening backtick\r\n if (tokenReader.peekTokenKind() !== TokenKind.Backtick) {\r\n // This would be a parser bug -- the caller of _parseCodeSpan() should have verified this while\r\n // looking ahead to distinguish code spans/fences\r\n throw new Error('Expecting a code span starting with a backtick character \"`\"');\r\n }\r\n\r\n tokenReader.readToken(); // read the backtick\r\n\r\n const openingDelimiterExcerpt: TokenSequence = tokenReader.extractAccumulatedSequence();\r\n\r\n let codeExcerpt: TokenSequence | undefined = undefined;\r\n let closingDelimiterExcerpt: TokenSequence | undefined = undefined;\r\n\r\n // Parse the content backtick\r\n for (;;) {\r\n const peekedTokenKind: TokenKind = tokenReader.peekTokenKind();\r\n // Did we find the matching token?\r\n if (peekedTokenKind === TokenKind.Backtick) {\r\n if (tokenReader.isAccumulatedSequenceEmpty()) {\r\n return this._backtrackAndCreateErrorRange(\r\n tokenReader,\r\n marker,\r\n marker + 1,\r\n TSDocMessageId.CodeSpanEmpty,\r\n 'A code span must contain at least one character between the backticks'\r\n );\r\n }\r\n\r\n codeExcerpt = tokenReader.extractAccumulatedSequence();\r\n\r\n tokenReader.readToken();\r\n closingDelimiterExcerpt = tokenReader.extractAccumulatedSequence();\r\n break;\r\n }\r\n if (peekedTokenKind === TokenKind.EndOfInput || peekedTokenKind === TokenKind.Newline) {\r\n return this._backtrackAndCreateError(\r\n tokenReader,\r\n marker,\r\n TSDocMessageId.CodeSpanMissingDelimiter,\r\n 'The code span is missing its closing backtick'\r\n );\r\n }\r\n tokenReader.readToken();\r\n }\r\n\r\n return new DocCodeSpan({\r\n parsed: true,\r\n configuration: this._configuration,\r\n\r\n openingDelimiterExcerpt,\r\n\r\n codeExcerpt,\r\n\r\n closingDelimiterExcerpt\r\n });\r\n }\r\n\r\n private _tryReadSpacingAndNewlines(tokenReader: TokenReader): TokenSequence | undefined {\r\n let done: boolean = false;\r\n do {\r\n switch (tokenReader.peekTokenKind()) {\r\n case TokenKind.Spacing:\r\n case TokenKind.Newline:\r\n tokenReader.readToken();\r\n break;\r\n default:\r\n done = true;\r\n break;\r\n }\r\n } while (!done);\r\n return tokenReader.tryExtractAccumulatedSequence();\r\n }\r\n\r\n /**\r\n * Read the next token, and report it as a DocErrorText node.\r\n */\r\n private _createError(\r\n tokenReader: TokenReader,\r\n messageId: TSDocMessageId,\r\n errorMessage: string\r\n ): DocErrorText {\r\n tokenReader.readToken();\r\n\r\n const textExcerpt: TokenSequence = tokenReader.extractAccumulatedSequence();\r\n\r\n const docErrorText: DocErrorText = new DocErrorText({\r\n parsed: true,\r\n configuration: this._configuration,\r\n\r\n textExcerpt,\r\n\r\n messageId,\r\n errorMessage,\r\n errorLocation: textExcerpt\r\n });\r\n this._parserContext.log.addMessageForDocErrorText(docErrorText);\r\n return docErrorText;\r\n }\r\n\r\n /**\r\n * Rewind to the specified marker, read the next token, and report it as a DocErrorText node.\r\n */\r\n private _backtrackAndCreateError(\r\n tokenReader: TokenReader,\r\n marker: number,\r\n messageId: TSDocMessageId,\r\n errorMessage: string\r\n ): DocErrorText {\r\n tokenReader.backtrackToMarker(marker);\r\n return this._createError(tokenReader, messageId, errorMessage);\r\n }\r\n\r\n /**\r\n * Rewind to the errorStartMarker, read the tokens up to and including errorInclusiveEndMarker,\r\n * and report it as a DocErrorText node.\r\n */\r\n private _backtrackAndCreateErrorRange(\r\n tokenReader: TokenReader,\r\n errorStartMarker: number,\r\n errorInclusiveEndMarker: number,\r\n messageId: TSDocMessageId,\r\n errorMessage: string\r\n ): DocErrorText {\r\n tokenReader.backtrackToMarker(errorStartMarker);\r\n while (tokenReader.createMarker() !== errorInclusiveEndMarker) {\r\n tokenReader.readToken();\r\n }\r\n if (tokenReader.peekTokenKind() !== TokenKind.EndOfInput) {\r\n tokenReader.readToken();\r\n }\r\n\r\n const textExcerpt: TokenSequence = tokenReader.extractAccumulatedSequence();\r\n\r\n const docErrorText: DocErrorText = new DocErrorText({\r\n parsed: true,\r\n configuration: this._configuration,\r\n\r\n textExcerpt,\r\n\r\n messageId,\r\n errorMessage: errorMessage,\r\n errorLocation: textExcerpt\r\n });\r\n this._parserContext.log.addMessageForDocErrorText(docErrorText);\r\n return docErrorText;\r\n }\r\n\r\n /**\r\n * Rewind to the specified marker, read the next token, and report it as a DocErrorText node\r\n * whose location is based on an IFailure.\r\n */\r\n private _backtrackAndCreateErrorForFailure(\r\n tokenReader: TokenReader,\r\n marker: number,\r\n errorMessagePrefix: string,\r\n failure: IFailure\r\n ): DocErrorText {\r\n tokenReader.backtrackToMarker(marker);\r\n tokenReader.readToken();\r\n\r\n const textExcerpt: TokenSequence = tokenReader.extractAccumulatedSequence();\r\n\r\n const docErrorText: DocErrorText = new DocErrorText({\r\n parsed: true,\r\n configuration: this._configuration,\r\n\r\n textExcerpt,\r\n\r\n messageId: failure.failureMessageId,\r\n errorMessage: errorMessagePrefix + failure.failureMessage,\r\n errorLocation: failure.failureLocation\r\n });\r\n this._parserContext.log.addMessageForDocErrorText(docErrorText);\r\n return docErrorText;\r\n }\r\n\r\n /**\r\n * Rewind to the errorStartMarker, read the tokens up to and including errorInclusiveEndMarker,\r\n * and report it as a DocErrorText node whose location is based on an IFailure.\r\n */\r\n private _backtrackAndCreateErrorRangeForFailure(\r\n tokenReader: TokenReader,\r\n errorStartMarker: number,\r\n errorInclusiveEndMarker: number,\r\n errorMessagePrefix: string,\r\n failure: IFailure\r\n ): DocErrorText {\r\n tokenReader.backtrackToMarker(errorStartMarker);\r\n while (tokenReader.createMarker() !== errorInclusiveEndMarker) {\r\n tokenReader.readToken();\r\n }\r\n if (tokenReader.peekTokenKind() !== TokenKind.EndOfInput) {\r\n tokenReader.readToken();\r\n }\r\n\r\n const textExcerpt: TokenSequence = tokenReader.extractAccumulatedSequence();\r\n\r\n const docErrorText: DocErrorText = new DocErrorText({\r\n parsed: true,\r\n configuration: this._configuration,\r\n\r\n textExcerpt,\r\n\r\n messageId: failure.failureMessageId,\r\n errorMessage: errorMessagePrefix + failure.failureMessage,\r\n errorLocation: failure.failureLocation\r\n });\r\n this._parserContext.log.addMessageForDocErrorText(docErrorText);\r\n return docErrorText;\r\n }\r\n\r\n /**\r\n * Creates an IFailure whose TokenSequence is a single token. If a marker is not specified,\r\n * then it is the current token.\r\n */\r\n private _createFailureForToken(\r\n tokenReader: TokenReader,\r\n failureMessageId: TSDocMessageId,\r\n failureMessage: string,\r\n tokenMarker?: number\r\n ): IFailure {\r\n if (!tokenMarker) {\r\n tokenMarker = tokenReader.createMarker();\r\n }\r\n\r\n const tokenSequence: TokenSequence = new TokenSequence({\r\n parserContext: this._parserContext,\r\n startIndex: tokenMarker,\r\n endIndex: tokenMarker + 1\r\n });\r\n\r\n return {\r\n failureMessageId,\r\n failureMessage,\r\n failureLocation: tokenSequence\r\n };\r\n }\r\n\r\n /**\r\n * Creates an IFailure whose TokenSequence starts from the specified marker and\r\n * encompasses all tokens read since then. If none were read, then the next token used.\r\n */\r\n private _createFailureForTokensSince(\r\n tokenReader: TokenReader,\r\n failureMessageId: TSDocMessageId,\r\n failureMessage: string,\r\n startMarker: number\r\n ): IFailure {\r\n let endMarker: number = tokenReader.createMarker();\r\n if (endMarker < startMarker) {\r\n // This would be a parser bug\r\n throw new Error('Invalid startMarker');\r\n }\r\n\r\n if (endMarker === startMarker) {\r\n ++endMarker;\r\n }\r\n\r\n const tokenSequence: TokenSequence = new TokenSequence({\r\n parserContext: this._parserContext,\r\n startIndex: startMarker,\r\n endIndex: endMarker\r\n });\r\n\r\n return {\r\n failureMessageId,\r\n failureMessage,\r\n failureLocation: tokenSequence\r\n };\r\n }\r\n}\r\n"]} |