public static function canFactorsInImplicitMultiplication($token1, $token2)
    {
        if ($token1 === null || $token2 === null) return false;

        $check1 = (
            $token1->type == TokenType::PosInt ||
            $token1->type == TokenType::Integer ||
            $token1->type == TokenType::RealNumber ||
            $token1->type == TokenType::Constant ||
            $token1->type == TokenType::Identifier ||
            $token1->type == TokenType::FunctionName ||
            $token1->type == TokenType::CloseParenthesis ||
            $token1->type == TokenType::FactorialOperator ||
            $token1->type == TokenType::SemiFactorialOperator
        );

        if (!$check1) return false;

        $check2 = (
            $token2->type == TokenType::PosInt ||
            $token2->type == TokenType::Integer ||
            $token2->type == TokenType::RealNumber ||
            $token2->type == TokenType::Constant ||
            $token2->type == TokenType::Identifier ||
            $token2->type == TokenType::FunctionName ||
            $token2->type == TokenType::OpenParenthesis
        );

        if (!$check2) return false;

        if ($token1->type == TokenType::FunctionName && $token2->type == TokenType::OpenParenthesis)
            return false;

        return true;
    }
public static function canFactorsInImplicitMultiplication($token1, $token2)
    {
        if ($token1 === null || $token2 === null) return false;

        $check1 = (
            $token1->type == TokenType::PosInt ||
            $token1->type == TokenType::Integer ||
            $token1->type == TokenType::RealNumber ||
            $token1->type == TokenType::Constant ||
            $token1->type == TokenType::Identifier ||
            $token1->type == TokenType::FunctionName ||
            $token1->type == TokenType::CloseParenthesis ||
            $token1->type == TokenType::FactorialOperator ||
            $token1->type == TokenType::SemiFactorialOperator
        );

        if (!$check1) return false;

        $check2 = (
            $token2->type == TokenType::PosInt ||
            $token2->type == TokenType::Integer ||
            $token2->type == TokenType::RealNumber ||
            $token2->type == TokenType::Constant ||
            $token2->type == TokenType::Identifier ||
            $token2->type == TokenType::FunctionName ||
            $token2->type == TokenType::OpenParenthesis
        );

        if (!$check2) return false;

        if ($token1->type == TokenType::FunctionName && $token2->type == TokenType::OpenParenthesis)
            return false;

        return true;
    }
public static function canFactorsInImplicitMultiplication ( $ token1 , $ token2 ) { if ( $ token1 === null || $ token2 === null ) return false ; $ check1 = ( $ token1 -> type == TokenType :: PosInt || $ token1 -> type == TokenType :: Integer || $ token1 -> type == TokenType :: RealNumber || $ token1 -> type == TokenType :: Constant || $ token1 -> type == TokenType :: Identifier || $ token1 -> type == TokenType :: FunctionName || $ token1 -> type == TokenType :: CloseParenthesis || $ token1 -> type == TokenType :: FactorialOperator || $ token1 -> type == TokenType :: SemiFactorialOperator ) ; if ( ! $ check1 ) return false ; $ check2 = ( $ token2 -> type == TokenType :: PosInt || $ token2 -> type == TokenType :: Integer || $ token2 -> type == TokenType :: RealNumber || $ token2 -> type == TokenType :: Constant || $ token2 -> type == TokenType :: Identifier || $ token2 -> type == TokenType :: FunctionName || $ token2 -> type == TokenType :: OpenParenthesis ) ; if ( ! $ check2 ) return false ; if ( $ token1 -> type == TokenType :: FunctionName && $ token2 -> type == TokenType :: OpenParenthesis ) return false ; return true ; }
Helper function, determining whether a pair of tokens
can form an implicit multiplication.

Mathematical shorthand writing often leaves out explicit multiplication
symbols, writing "2x" instead of "2*x" or "2 \cdot x". The parser
accepts implicit multiplication if the first token is a nullary operator
or a a closing parenthesis, and the second token is a nullary operator
or an opening parenthesis. (Unless the first token is a a function name,
and the second is an opening parentheis.)

@retval boolean
Helper function determining whether a pair of tokens can form an implicit multiplication .