System.Text.RegularExpressions.RegexFC.AddFC C# (CSharp) Method

AddFC() private method

private AddFC ( RegexFC fc, bool concatenate ) : bool
fc RegexFC
concatenate bool
return bool
        internal bool AddFC(RegexFC fc, bool concatenate)
        {
            if (!_cc.CanMerge || !fc._cc.CanMerge)
            {
                return false;
            }

            if (concatenate)
            {
                if (!_nullable)
                    return true;

                if (!fc._nullable)
                    _nullable = false;
            }
            else
            {
                if (fc._nullable)
                    _nullable = true;
            }

            _caseInsensitive |= fc._caseInsensitive;
            _cc.AddCharClass(fc._cc);
            return true;
        }

Usage Example

Esempio n. 1
0
        private void CalculateFC(int NodeType, RegexNode node, int CurIndex)
        {
            bool caseInsensitive = false;
            bool flag2           = false;

            if (NodeType <= 13)
            {
                if ((node._options & RegexOptions.IgnoreCase) != RegexOptions.None)
                {
                    caseInsensitive = true;
                }
                if ((node._options & RegexOptions.RightToLeft) != RegexOptions.None)
                {
                    flag2 = true;
                }
            }
            switch (NodeType)
            {
            case 3:
            case 6:
                this.PushFC(new RegexFC(node._ch, false, node._m == 0, caseInsensitive));
                return;

            case 4:
            case 7:
                this.PushFC(new RegexFC(node._ch, true, node._m == 0, caseInsensitive));
                return;

            case 5:
            case 8:
                this.PushFC(new RegexFC(node._str, node._m == 0, caseInsensitive));
                return;

            case 9:
            case 10:
                this.PushFC(new RegexFC(node._ch, NodeType == 10, false, caseInsensitive));
                return;

            case 11:
                this.PushFC(new RegexFC(node._str, false, caseInsensitive));
                return;

            case 12:
                if (node._str.Length != 0)
                {
                    if (!flag2)
                    {
                        this.PushFC(new RegexFC(node._str[0], false, false, caseInsensitive));
                        return;
                    }
                    this.PushFC(new RegexFC(node._str[node._str.Length - 1], false, false, caseInsensitive));
                    return;
                }
                this.PushFC(new RegexFC(true));
                return;

            case 13:
                this.PushFC(new RegexFC("\0\x0001\0\0", true, false));
                return;

            case 14:
            case 15:
            case 0x10:
            case 0x11:
            case 0x12:
            case 0x13:
            case 20:
            case 0x15:
            case 0x16:
            case 0x29:
            case 0x2a:
                this.PushFC(new RegexFC(true));
                return;

            case 0x17:
                this.PushFC(new RegexFC(true));
                return;

            case 0x58:
            case 0x59:
            case 90:
            case 0x5b:
            case 0x5c:
            case 0x5d:
            case 0x60:
            case 0x61:
            case 0x9c:
            case 0x9d:
            case 0x9e:
            case 0x9f:
            case 160:
                return;

            case 0x5e:
            case 0x5f:
                this.SkipChild();
                this.PushFC(new RegexFC(true));
                return;

            case 0x62:
                if (CurIndex == 0)
                {
                    this.SkipChild();
                }
                return;

            case 0x98:
            case 0xa1:
                if (CurIndex != 0)
                {
                    RegexFC fc   = this.PopFC();
                    RegexFC xfc6 = this.TopFC();
                    this._failed = !xfc6.AddFC(fc, false);
                }
                return;

            case 0x99:
                if (CurIndex != 0)
                {
                    RegexFC xfc  = this.PopFC();
                    RegexFC xfc2 = this.TopFC();
                    this._failed = !xfc2.AddFC(xfc, true);
                }
                if (!this.TopFC()._nullable)
                {
                    this._skipAllChildren = true;
                }
                return;

            case 0x9a:
            case 0x9b:
                if (node._m == 0)
                {
                    this.TopFC()._nullable = true;
                }
                return;

            case 0xa2:
                if (CurIndex > 1)
                {
                    RegexFC xfc3 = this.PopFC();
                    RegexFC xfc4 = this.TopFC();
                    this._failed = !xfc4.AddFC(xfc3, false);
                }
                return;
            }
            throw new ArgumentException(SR.GetString("UnexpectedOpcode", new object[] { NodeType.ToString(CultureInfo.CurrentCulture) }));
        }
All Usage Examples Of System.Text.RegularExpressions.RegexFC::AddFC