import { TokenStream } from '../classes/TokenStream'; import { CommentWithPosition, CommentStatement, Statement } from '../types/Ast.type'; export declare class CommentParser { /** * Parse comments from the stream and determine if they should be attached to the next statement * or kept as a standalone comment node * * Strategy: * 1. Collect all consecutive comments * 2. After comments, if we hit a newline, check if next token is also newline (blank line) * 3. If blank line -> create standalone comment node * 4. Otherwise -> return comments to attach to next statement * * @param stream - TokenStream positioned at a COMMENT token * @returns Object with: * - comments: Array of CommentWithPosition for comments to attach * - commentNode: CommentStatement if comments should be standalone (orphaned) * - consumed: Whether comments were consumed from the stream */ static parseComments(stream: TokenStream): { comments: CommentWithPosition[]; commentNode: CommentStatement | null; consumed: boolean; }; /** * Parse inline comment from the stream (comment on same line as code) * * @param stream - TokenStream positioned at a COMMENT token * @param statementLine - Line number of the statement (0-based) * @returns CommentWithPosition if inline comment found, null otherwise */ static parseInlineComment(stream: TokenStream, statementLine: number): CommentWithPosition | null; /** * Attach comments to a statement */ static attachComments(statement: Statement, comments: CommentWithPosition[]): void; }