/** * Tokenizer for LiquidDoc body content. * * LiquidDoc is line-oriented: annotations start with `@name` at the beginning * of a (whitespace-trimmed) line. Content runs until the next annotation or * end-of-input. * * SPIKE CONSTRAINT DISCOVERED: We cannot tokenize `{type}`, `[name]`, and `-` * at the top level because those characters appear in content (e.g. `{{ x }}` * in @example blocks). These sub-tokens only make sense inside @param context. * * Solution: two-level tokenization. * - Level 1 (this file): splits into Annotation, TextLine, Newline, EndOfInput. * - Level 2 (tokenizeParamContent): splits a @param's text into Type, OptionalName, etc. */ export declare enum LiquidDocTokenType { /** `@param`, `@example`, `@description`, `@prompt`, etc. */ Annotation = "Annotation", /** A contiguous run of text on a single line (leading whitespace stripped). */ TextLine = "TextLine", /** A newline character (or \r\n). */ Newline = "Newline", /** End of input sentinel. */ EndOfInput = "EndOfInput" } export interface LiquidDocToken { type: LiquidDocTokenType; value: string; /** Absolute offset in the full source document. */ start: number; /** Absolute offset, exclusive. */ end: number; } /** Tokens for the @param sub-grammar. */ export declare enum ParamTokenType { /** `{type}` — a type annotation inside braces. */ Type = "Type", /** `[name]` — an optional param name in square brackets. */ OptionalName = "OptionalName", /** A bare word. */ Word = "Word", /** `-` dash separator. */ Dash = "Dash", /** Remaining text after name/dash. */ Text = "Text", /** End sentinel. */ EndOfInput = "EndOfInput" } export interface ParamToken { type: ParamTokenType; value: string; start: number; end: number; } /** * Tokenize the body of a LiquidDoc block (level 1). * * @param body - The raw text between `{% doc %}` and `{% enddoc %}`. * @param startOffset - The absolute offset of `body[0]` in the full source document. */ export declare function tokenizeLiquidDoc(body: string, startOffset: number): LiquidDocToken[]; /** * Tokenize the inline content of a @param annotation (level 2). * * Input: the text that follows `@param ` on the same line, e.g. `{string} [title] - The title`. * Positions are absolute (document-relative). */ export declare function tokenizeParamContent(text: string, startOffset: number): ParamToken[];