psl-parser
Version:
A parser for the Profile Scripting Language
48 lines (47 loc) • 1.89 kB
TypeScript
import { Member, Method, ParsedDocument } from './parser';
import { Position, Token } from './tokenizer';
export interface FinderResult {
fsPath: string;
member?: Member;
}
export interface FinderPaths {
routine: string;
projectPsl: string[];
corePsl: string;
table: string;
}
export declare const dummyPosition: Position;
export declare class ParsedDocFinder {
parsedDocument: ParsedDocument;
paths: FinderPaths;
procName: string;
private hierarchy;
constructor(parsedDocument: ParsedDocument, paths: FinderPaths, getWorkspaceDocumentText?: (fsPath: string) => Promise<string>);
resolveResult(callTokens: Token[]): Promise<FinderResult>;
newFinder(routineName: string): Promise<ParsedDocFinder | undefined>;
/**
* Search the parsed document and parents for a particular member
*/
searchParser(queriedToken: Token): Promise<FinderResult | undefined>;
searchInDocument(queriedId: string): Promise<FinderResult | undefined>;
findAllInDocument(results?: FinderResult[]): Promise<FinderResult[] | undefined>;
private searchForParent;
private searchInMethod;
private findActiveMethod;
private getWorkspaceDocumentText;
}
/**
* Get the tokens on the line of position, as well as the specific index of the token at position
*/
export declare function searchTokens(tokens: Token[], position: Position): {
tokensOnLine: Token[];
index: number;
};
export declare function getCallTokens(tokensOnLine: Token[], index: number): Token[];
export declare function resolve(tokens: Token[]): number;
export declare function findCallable(tokensOnLine: Token[], index: number): {
callTokens: Token[];
parameterIndex: number;
};
export declare function getLineAfter(method: Method): number;
export declare function getCommentsOnLine(parsedDocument: ParsedDocument, lineNumber: number): Token[];