/** * Recursive-descent parser for LiquidDoc body content. * * Consumes level-1 tokens (Annotation, TextLine, Newline) from the body * tokenizer. For @param, re-tokenizes the inline content using the level-2 * param tokenizer to extract {type}, [name], -, and description. * * No raw string scanning in this file — all extraction is token-based. */ import type { LiquidDocToken } from './tokenizer'; import type { TextNode, LiquidDocParamNode, LiquidDocDescriptionNode, LiquidDocExampleNode, LiquidDocPromptNode } from '../ast'; /** Union of all nodes that can appear in a LiquidDoc body. */ export type LiquidDocNode = LiquidDocParamNode | LiquidDocDescriptionNode | LiquidDocExampleNode | LiquidDocPromptNode | TextNode; /** * Parse a LiquidDoc body string into AST nodes. */ export declare function parseLiquidDoc(body: string, startOffset: number, source: string): LiquidDocNode[]; export declare class LiquidDocParser { private tokens; private source; private p; constructor(tokens: LiquidDocToken[], source: string); /** * Parse the full LiquidDoc body into a list of nodes. */ parse(): LiquidDocNode[]; private parseImplicitDescription; private parseAnnotation; /** * Parse @param using the level-2 param tokenizer. * * The first TextLine after `@param` is re-tokenized into {type}, [name], -, word, text. * Subsequent lines (collected via collectContentLines) are appended to the description. */ private parseParam; private parseDescription; private parseGluedDescription; private parseExample; private parsePrompt; private parseUnsupportedAnnotation; private peek; private consume; private accept; private check; private isAtEnd; /** Consume the current token unconditionally and advance. */ private advance; private skipNewlines; /** Skip newlines and whitespace-only text lines (e.g. indentation with no content). */ private skipBlankLines; /** * Collect text lines and newlines until the next @annotation or end of input. * Returns the concatenated content and end position. * * Options: * - stopAtParagraphBreak: stop at blank line + non-annotation text (for @param) * - trimTrailingNewlines: strip trailing \n from value (for @param + free text) */ private collectContentLines; }