@aurahelper/languages
Version:
Language Libraries to work with XML, Aura, Apex... files. tokenizers, parsers, system classes and much more
56 lines (55 loc) • 2.7 kB
TypeScript
import { Position, Token } from "@aurahelper/core";
/**
* Class with some util methods to support language analize
*/
export declare class LanguageUtils {
/**
* Method to get N new lines symbols (\n)
* @param {number} number Number of new lines
* @returns {string} Return an string with the N specified new lines
*/
static getNewLines(number: number): string;
/**
* Method to get N whitespaces ( )
* @param {number} number Number of whitespaces
* @returns {string} Return an string with the N specified whitespaces
*/
static getWhitespaces(number: number): string;
/**
* Method to get the next token from the specified index
* @param {Token[]} tokens Tokens to get the next one
* @param {number} index Index to get the next token from it.
* @returns {Token | undefined} Return the next token or undefined if has no token.
*/
static getNextToken(tokens: Token[], index: number): Token | undefined;
/**
* Method to get the two next token from the specified index
* @param {Token[]} tokens Tokens to get the two next token
* @param {number} index Index to get the two next token from it.
* @returns {Token | undefined} Return the two next token or undefined if has no token.
*/
static getTwoNextToken(tokens: Token[], index: number): Token | undefined;
/**
* Method to get the last token from the specified index
* @param {Token[]} tokens Tokens to get the last token
* @param {number} index Index to get the last token from it.
* @returns {Token | undefined} Return the last token or undefined if has no token.
*/
static getLastToken(tokens: Token[], index: number): Token | undefined;
/**
* Method to get the two last token from the specified index
* @param {Token[]} tokens Tokens to get the two last token
* @param {number} index Index to get the two last token from it.
* @returns {Token | undefined} Return the two last token or undefined if has no token.
*/
static getTwoLastToken(tokens: Token[], index: number): Token | undefined;
/**
* Method to check if the analyzed tokens is on Cursor Position on file
* @param {Token} token Actual token
* @param {Token} [lastToken] Last token from actual token
* @param {Token} [nextToken] Next token from acual token
* @param {Position} [cursorPosition] Cursor position on file
* @returns {boolean} Returns true if analyzed tokens is on Cursor Position
*/
static isOnPosition(token: Token, lastToken?: Token, nextToken?: Token, cursorPosition?: Position): boolean;
}