import ASTNode from "./ast/ASTNode"; import ASTVisitor from "./ast/ASTVisitor"; import ASTAssembler from "./ASTAssembler"; import CodeLocation from "./CodeLocation"; import Token from "./Token"; export declare const BinAfter: unique symbol; export declare const BinBefore: unique symbol; export type PinpointerRet = ASTNode | typeof BinAfter | typeof BinBefore; export type DispatchTokenMix = (Token | (() => PinpointerRet))[]; /** * This class searches through the AST to find a node based on its position. * It may return BinAfter or BinBefore if the node cannot be found. */ export default class ASTPinpointer extends ASTAssembler implements ASTVisitor { pinpointLocation: CodeLocation; /** * Contains all the ancestors of the pinpointed nodes. The pinpointed node is always first. */ bottomUpHierarchy: ASTNode[]; constructor(pinpointLocation: CodeLocation); /** * Returns the node at pinpointLocation and populates bottomUpHierarchy. * @param n The AST (or AST fragment) to search through. */ doPinpoint(n: ASTNode): PinpointerRet; protected processAssembledNode(t: DispatchTokenMix, self: ASTNode): PinpointerRet; }