AddChild() private method

private AddChild ( RegexNode newChild ) : void
newChild RegexNode
return void
Esempio n. 1
0
        internal RegexNode MakePossessive()
        {
            var result = new RegexNode(Greedy, _options);

            result.AddChild(this);
            return(result);
        }
Esempio n. 2
0
        internal RegexNode MakeQuantifier(bool lazy, int min, int max)
        {
            RegexNode result;

            if (min == 0 && max == 0)
            {
                return(new RegexNode(Empty, _options));
            }

            if (min == 1 && max == 1)
            {
                return(this);
            }

            switch (_type)
            {
            case One:
            case Notone:
            case Set:

                MakeRep(lazy ? Onelazy : Oneloop, min, max);
                return(this);

            default:
                result = new RegexNode(lazy ? Lazyloop : Loop, _options, min, max);
                result.AddChild(this);
                return(result);
            }
        }
Esempio n. 3
0
        /*
         * Remember the pushed state (in response to a ')')
         */
        internal void PopGroup()
        {
            _concatenation = _stack;
            _alternation = _concatenation._next;
            _group = _alternation._next;
            _stack = _group._next;

            // The first () inside a Testgroup group goes directly to the group
            if (_group.Type() == RegexNode.Testgroup && _group.ChildCount() == 0)
            {
                if (_unit == null)
                    throw MakeException(SR.IllegalCondition);

                _group.AddChild(_unit);
                _unit = null;
            }
        }
Esempio n. 4
0
        internal RegexNode MakeQuantifier(bool lazy, int min, int max)
        {
            RegexNode result;

            if (min == 0 && max == 0)
                return new RegexNode(Empty, _options);

            if (min == 1 && max == 1)
                return this;

            switch (_type)
            {
                case One:
                case Notone:
                case Set:

                    MakeRep(lazy ? Onelazy : Oneloop, min, max);
                    return this;

                default:
                    result = new RegexNode(lazy ? Lazyloop : Loop, _options, min, max);
                    result.AddChild(this);
                    return result;
            }
        }