public bool IsMatch(ref Token token)
        {
            bool isMatch = true;

            if (token.Length < 1)
            {
                return(false);
            }                                       //Empty tokens never match

            if (Mode == PatternMatchingMode.And)
            {
                return(LeftSide.IsMatch(ref token) && RightSide.IsMatch(ref token));
            }
            else if (Mode == PatternMatchingMode.Or)
            {
                return(LeftSide.IsMatch(ref token) || RightSide.IsMatch(ref token));
            }
            else
            {
                if (isMatch && (Type & PatternUnitType.Length) == PatternUnitType.Length)
                {
                    isMatch &= MatchLength(ref token);
                }
                if (isMatch && (Type & PatternUnitType.Token) == PatternUnitType.Token)
                {
                    isMatch &= MatchToken(ref token);
                }
                if (isMatch && (Type & PatternUnitType.Shape) == PatternUnitType.Shape)
                {
                    isMatch &= MatchShape(ref token);
                }
                if (isMatch && (Type & PatternUnitType.WithChars) == PatternUnitType.WithChars)
                {
                    isMatch &= MatchWithChars(ref token);
                }
                //if (isMatch && (Type & PatternUnitType.Script) == PatternUnitType.Script)                                 { isMatch &= MatchScript(ref token); }
                if (isMatch && (Type & PatternUnitType.POS) == PatternUnitType.POS)
                {
                    isMatch &= MatchPOS(ref token);
                }
                if (isMatch && (Type & PatternUnitType.MultiplePOS) == PatternUnitType.MultiplePOS)
                {
                    isMatch &= MatchMultiplePOS(ref token);
                }
                if (isMatch && (Type & PatternUnitType.Suffix) == PatternUnitType.Suffix)
                {
                    isMatch &= MatchSuffix(ref token);
                }
                if (isMatch && (Type & PatternUnitType.Prefix) == PatternUnitType.Prefix)
                {
                    isMatch &= MatchPrefix(ref token);
                }
                if (isMatch && (Type & PatternUnitType.Set) == PatternUnitType.Set)
                {
                    isMatch &= MatchSet(ref token);
                }
                if (isMatch && (Type & PatternUnitType.Entity) == PatternUnitType.Entity)
                {
                    isMatch &= MatchEntity(ref token);
                }
                if (isMatch && (Type & PatternUnitType.NotEntity) == PatternUnitType.NotEntity)
                {
                    isMatch &= !MatchEntity(ref token);
                }
                if (isMatch && (Type & PatternUnitType.IsDigit) == PatternUnitType.IsDigit)
                {
                    isMatch &= MatchIsDigit(ref token);
                }
                if (isMatch && (Type & PatternUnitType.IsNumeric) == PatternUnitType.IsNumeric)
                {
                    isMatch &= MatchIsNumeric(ref token);
                }
                if (isMatch && (Type & PatternUnitType.HasNumeric) == PatternUnitType.HasNumeric)
                {
                    isMatch &= MatchHasNumeric(ref token);
                }
                if (isMatch && (Type & PatternUnitType.IsAlpha) == PatternUnitType.IsAlpha)
                {
                    isMatch &= MatchIsAlpha(ref token);
                }
                if (isMatch && (Type & PatternUnitType.IsLetterOrDigit) == PatternUnitType.IsLetterOrDigit)
                {
                    isMatch &= MatchIsLetterOrDigit(ref token);
                }
                //if (isMatch && (Type & PatternUnitType.IsLatin) == PatternUnitType.IsLatin)                               { isMatch &= MatchIsLatin         (ref token); }
                if (isMatch && (Type & PatternUnitType.IsEmoji) == PatternUnitType.IsEmoji)
                {
                    isMatch &= MatchIsEmoji(ref token);
                }
                if (isMatch && (Type & PatternUnitType.IsPunctuation) == PatternUnitType.IsPunctuation)
                {
                    isMatch &= MatchIsPunctuation(ref token);
                }
                if (isMatch && (Type & PatternUnitType.IsLowerCase) == PatternUnitType.IsLowerCase)
                {
                    isMatch &= MatchIsLowerCase(ref token);
                }
                if (isMatch && (Type & PatternUnitType.IsUpperCase) == PatternUnitType.IsUpperCase)
                {
                    isMatch &= MatchIsUpperCase(ref token);
                }
                if (isMatch && (Type & PatternUnitType.IsTitleCase) == PatternUnitType.IsTitleCase)
                {
                    isMatch &= MatchIsTitleCase(ref token);
                }
                if (isMatch && (Type & PatternUnitType.LikeURL) == PatternUnitType.LikeURL)
                {
                    isMatch &= MatchLikeURL(ref token);
                }
                if (isMatch && (Type & PatternUnitType.LikeEmail) == PatternUnitType.LikeEmail)
                {
                    isMatch &= MatchLikeEmail(ref token);
                }
                if (isMatch && (Type & PatternUnitType.IsOpeningParenthesis) == PatternUnitType.IsOpeningParenthesis)
                {
                    isMatch &= MatchIsOpeningParenthesis(ref token);
                }
                if (isMatch && (Type & PatternUnitType.IsClosingParenthesis) == PatternUnitType.IsClosingParenthesis)
                {
                    isMatch &= MatchIsClosingParenthesis(ref token);
                }
            }

            return(Mode == PatternMatchingMode.ShouldNotMatch ? !isMatch : isMatch);
        }