import type { Token } from './tokenizer'; import { ParserBase } from './base'; import type { LiquidTagEnvelope, LiquidOpenWhitespace, LiquidCloseWhitespace } from './factories'; import { ChildFilterMode } from './tree-builder'; import type { Position } from '../types'; import type { LiquidHtmlNode, LiquidTag, LiquidRawTag, LiquidBranch, LiquidBranchUnnamed, LiquidBranchNamed, AttributeNode } from '../ast'; import type { TagDefinitionBlock, BranchName, Parser } from '../environment'; /** * Interface capturing what block-parsing free functions need from the * DocumentParser. The parser class satisfies this contract, keeping * the coupling explicit and narrow. */ export interface BlockParserDelegate extends ParserBase, Parser { readonly blockEnv: { tagForName(name: string): { kind: string; } | undefined; }; readonly blockParseHtml: boolean; blockAllowUnclosedHtml: boolean; readonly blockAllowUnclosedDocumentNode: boolean; readonly blockInAttributeContext: boolean; readonly blockInAttributeValueContext: boolean; parseNode(): LiquidHtmlNode; peekTagName(): string | null; consumeEndTag(): { position: Position; whitespace: { start: LiquidOpenWhitespace; end: LiquidCloseWhitespace; }; }; isBlockTerminator(): boolean; parseBranchAttributes(): AttributeNode[]; parseLiquidTag(): LiquidTag | LiquidRawTag; } export declare function parseBlockTag(parser: BlockParserDelegate, def: TagDefinitionBlock, envelope: LiquidTagEnvelope, closeToken: Token): LiquidTag; export declare function parseBlockBody(parser: BlockParserDelegate, envelope: LiquidTagEnvelope): { children: LiquidHtmlNode[]; endPosition: Position; endWhitespace: { start: LiquidOpenWhitespace; end: LiquidCloseWhitespace; }; }; export declare function parseBranchedBody(parser: BlockParserDelegate, envelope: LiquidTagEnvelope, def: TagDefinitionBlock): { branches: LiquidBranch[]; endPosition: Position; endWhitespace: { start: LiquidOpenWhitespace; end: LiquidCloseWhitespace; }; }; export declare function finalizeBranch(branch: LiquidBranchUnnamed | LiquidBranchNamed, children: LiquidHtmlNode[], endPos: number, source: string, mode?: ChildFilterMode): void; export declare function parseBranchMarkup(parser: BlockParserDelegate, branchName: BranchName, envelope: LiquidTagEnvelope): unknown; export declare function peekTagName(parser: ParserBase): string | null; export declare function isBlockTerminator(parser: ParserBase): boolean; export declare function consumeEndTag(parser: ParserBase): { position: Position; whitespace: { start: LiquidOpenWhitespace; end: LiquidCloseWhitespace; }; }; export declare function isBranchName(value: string | null | undefined): value is BranchName;