Ejemplo n.º 1
0
        private void Merge(ref LinkedListNode <Token> begin, RangeToken range)
        {
            var node = begin.Next;

            while (node != null)
            {
                RangeToken temp;
                if (_rangeMap.TryGetValue(node.Value.Type, out temp))
                {
                    Merge(ref node, temp);
                }
                else if (node.Value.Type == range.End)
                {
                    var last = begin.Previous;
                    var list = new List <Token>(ESUtility.Range(begin.Next, node));
                    ESUtility.Remove(_tokens, begin, node.Next);
                    begin = _tokens.AddAfter(last, (new Token {
                        Type = range.Target, Value = list
                    })).Next;
                    break;
                }
                else
                {
                    node = node.Next;
                }
            }
        }