@aurahelper/languages
Version:
Language Libraries to work with XML, Aura, Apex... files. tokenizers, parsers, system classes and much more
62 lines (61 loc) • 2.13 kB
TypeScript
import { Token, Position, AuraJSFile } from "@aurahelper/core";
/**
* Class to Parse Aura Javascript files to extract data from files
*/
export declare class JSParser {
fileName?: string;
tokens: Token[];
tokensLength: number;
filePath?: string;
content?: string;
cursorPosition?: Position;
node?: AuraJSFile;
tabSize: number;
/**
* Create new JSParser instance to analize Aura Javscript file
* @param {string | Token[]} [filePathOrTokens] File path or Tokens (tokens from JSTokenizer class)
* @param {string} [fileName] File name
*/
constructor(filePathOrTokens?: string | Token[], fileName?: string);
/**
* Method to set the tab size
* @param {number} tabSize Tab size value
* @returns {JSParser} Return the JSParser instance
*/
setTabSize(tabSize: number): JSParser;
/**
* Method to set the file tokens
* @param {Token[]} tokens File tokens
* @returns {JSParser} Return the JSParser instance
*/
setTokens(tokens: Token[]): JSParser;
/**
* Method to set the file path
* @param {string} filePath File path value
* @returns {JSParser} Return the JSParser instance
*/
setFilePath(filePath: string): JSParser;
/**
* Method to set the file name
* @param {string} fileName File name value
* @returns {JSParser} Return the JSParser instance
*/
setFileName(fileName: string): JSParser;
/**
* Method to set the file content
* @param {string} content File content value
* @returns {JSParser} Return the JSParser instance
*/
setContent(content: string): JSParser;
/**
* Method to set the cusor Position on file
* @param {Position} position Cursor Position object
* @returns {JSParser} Return the JSParser instance
*/
setCursorPosition(position?: Position): JSParser;
/**
* Method to parse Aura Javascript file and get file information
* @returns Return the AuraJSFile node with file data
*/
parse(): AuraJSFile | undefined;
}