@aurahelper/languages
Version:
Language Libraries to work with XML, Aura, Apex... files. tokenizers, parsers, system classes and much more
69 lines (68 loc) • 2.58 kB
TypeScript
import { AuraApplication, AuraComponent, AuraEvent, Position, Token } from "@aurahelper/core";
/**
* Class to parse Aura XML files to extract data from files
*/
export declare class AuraParser {
tokens: Token[];
tokensLength: number;
fileName?: string;
filePath?: string;
content?: string;
cursorPosition?: Position;
node?: AuraComponent | AuraEvent | AuraApplication;
onlyTagData: boolean;
_tabSize: number;
/**
* Create new Aura Parser instance to parse Aura XML files
* @param {string | Token[]} [filePathOrTokens]
* @param {string} [fileName]
*/
constructor(filePathOrTokens?: string | Token[], fileName?: string);
/**
* Method to get only the tag data from Cursor position
* @param {boolean} onlyTagData True to get only tag data, false to pase the entire file
* @returns {AuraParser} Returns the AuraParser instance
*/
getOnlyTagData(onlyTagData: boolean): AuraParser;
/**
* Method to set the file tokens to parse
* @param {Token[]} tokens File tokens
* @returns {AuraParser} Returns the AuraParser instance
*/
setTokens(tokens: Token[]): AuraParser;
/**
* Method to set the file path
* @param {string} filePath File path value
* @returns {AuraParser} Returns the AuraParser instance
*/
setFilePath(filePath: string): AuraParser;
/**
* Method to set the file name
* @param {string} fileName File name value
* @returns {AuraParser} Returns the AuraParser instance
*/
setFileName(fileName: string): AuraParser;
/**
* Method to set the file content
* @param {string} content File content value
* @returns {AuraParser} Returns the AuraParser instance
*/
setContent(content?: string): AuraParser;
/**
* Method to set the cursor position on file
* @param {Position} position Position object
* @returns {AuraParser} Returns the AuraParser instance
*/
setCursorPosition(position?: Position): AuraParser;
/**
* Method to set the file tab size
* @param {number} tabSize File tab size value
* @returns {AuraParser} Returns the AuraParser instance
*/
setTabSize(tabSize: number): AuraParser;
/**
* Method to parse Aura XML file to extract data
* @returns { AuraComponent | AuraApplication | AuraEvent | undefined } Returns the selected file or false if not exists
*/
parse(): AuraComponent | AuraEvent | AuraApplication | undefined;
}