UNPKG

proc_macro

Version:
32 lines 1.22 kB
import { IString, IJavaScript, IEqual } from "../utils/interfaces"; import { TokenStream } from ".."; /** * Abstract definition of a parsing token. */ export default abstract class Token implements IString, IJavaScript, IEqual { abstract toParenthesisString(): string; abstract toJavaScript(): string; abstract eq(other: any): boolean; /** * Method that attempts to tokenize the next char(s). * @param _ The string to try to tokenize. * @event TokenizeError If the next char(s) cannot be tokenized, an error is produced. */ static tokenize(_: string): [Token, string]; /** * Checks if the structure can be tokenized. * @param tokenString The string trying to tokenize. */ static canTokenize(tokenString: string): boolean; /** * Method that attempts to parse the next token into this token. * @throws If the next token(s) cannot be parsed, an error is produced. */ static parse<T extends Token>(tokenStream: TokenStream): T; /** * Checks if the class can be parsed. * @param tokenStream The TokenStream trying to parse. */ static canParse(tokenStream: TokenStream): boolean; } //# sourceMappingURL=token.d.ts.map