Beispiel #1
0
        private void ProcessOperatorForOr()
        {
            if (this._orCount == 0 || this.LastOperator() != "|")
            {
                return;
            }

            var matches = this.GetMatchCollection();

            if (matches.Count >= 2)
            {
                // 1. Get last 2
                var lastIndex = matches.Count - 1;
                var right     = matches[lastIndex];
                var left      = matches[lastIndex - 1];

                // 2. Create a or group
                var groupOr = new TokenGroupOr(left, right);

                // 3. Remove last 2
                matches.RemoveAt(lastIndex);
                matches.RemoveAt(lastIndex - 1);
                matches.Add(groupOr);

                _orCount--;
                this.RemoveLastOperator();
            }
        }
Beispiel #2
0
        private void ProcessOperatorForOr()
        {
            if (this._orCount == 0 || this.LastOperator() != "|")
            {
                return;
            }

            var matches = this.GetMatchCollection();
            if (matches.Count >= 2)
            {
                // 1. Get last 2
                var lastIndex = matches.Count - 1;
                var right = matches[lastIndex];
                var left = matches[lastIndex - 1];

                // 2. Create a or group
                var groupOr = new TokenGroupOr(left, right);

                // 3. Remove last 2
                matches.RemoveAt(lastIndex);
                matches.RemoveAt(lastIndex - 1);
                matches.Add(groupOr);

                _orCount--;
                this.RemoveLastOperator();
            }
        }