import { Token } from './token' ; import { TokenTypeHelper } from './token.type.helper' ; export abstract class TokenHelperBase extends TokenTypeHelper { public static isToken ( token ) { const validators = [ TokenHelperBase . isNumeric , TokenHelperBase . isSymbol , TokenHelperBase . isObject ] ; return token && validators . some ( validator => validator ( token ) ) ; } public static isUnkown ( token ) { return token === undefined || token === null ; } public static isLineEscape ( token ) { return token === '\n' ; } public static isWhiteSpace ( token ) { return Token . whiteSpace . includes ( String ( token ) ) ; } public static isDot ( token ) { return token === Token . literal . Dot ; } public static isAddition ( token ) { return Token . addition . includes ( token ) ; } public static isSubtraction ( token ) { return Token . subtraction . includes ( token ) ; } public static isMultiplication ( token ) { return Token . multiplication . includes ( token ) ; } public static isDivision ( token ) { return Token . division . includes ( token ) ; } public static isMod ( token ) { return Token . mod . includes ( token ) ; } public static isPow ( token ) { return Token . pow . includes ( token ) ; } public static isBracket ( token ) { return Token . bracket . includes ( token ) ; } public static isBracketOpen ( token ) { return token === Token . bracketOpen ; } public static isBracketClose ( token ) { return token === Token . bracketClose ; } public static isSymbol ( token ) { return Token . symbols . includes ( String ( token ) ) ; } public static isOperator ( token ) { return Token . operators . includes ( String ( token ) ) ; } }