Ejemplo n.º 1
0
 public void Prepend(MixedCodeDocumentFragment newFragment)
 {
     if (newFragment == null)
     {
         throw new ArgumentNullException("newFragment");
     }
     this._items.Insert(0, newFragment);
 }
Ejemplo n.º 2
0
 public void Append(MixedCodeDocumentFragment newFragment)
 {
     if (newFragment == null)
     {
         throw new ArgumentNullException("newFragment");
     }
     this._items.Add(newFragment);
 }
Ejemplo n.º 3
0
        public void Remove(MixedCodeDocumentFragment fragment)
        {
            if (fragment == null)
            {
                throw new ArgumentNullException("fragment");
            }
            int fragmentIndex = this.GetFragmentIndex(fragment);

            if (fragmentIndex == -1)
            {
                throw new IndexOutOfRangeException();
            }
            this.RemoveAt(fragmentIndex);
        }
Ejemplo n.º 4
0
 internal int GetFragmentIndex(MixedCodeDocumentFragment fragment)
 {
     if (fragment == null)
     {
         throw new ArgumentNullException("fragment");
     }
     for (int i = 0; i < this._items.Count; i++)
     {
         if (((MixedCodeDocumentFragment)this._items[i]) == fragment)
         {
             return(i);
         }
     }
     return(-1);
 }
Ejemplo n.º 5
0
        private void Parse()
        {
            this._state           = ParseState.Text;
            this._index           = 0;
            this._currentfragment = this.CreateFragment(MixedCodeDocumentFragmentType.Text);
            while (this._index < this._text.Length)
            {
                this._c = this._text[this._index];
                this.IncrementPosition();
                switch (this._state)
                {
                case ParseState.Text:
                    if (((this._index + this.TokenCodeStart.Length) < this._text.Length) && (this._text.Substring(this._index - 1, this.TokenCodeStart.Length) == this.TokenCodeStart))
                    {
                        this._state = ParseState.Code;
                        this._currentfragment._length = (this._index - 1) - this._currentfragment._index;
                        this._currentfragment         = this.CreateFragment(MixedCodeDocumentFragmentType.Code);
                        this.SetPosition();
                    }
                    break;

                case ParseState.Code:
                    if (((this._index + this.TokenCodeEnd.Length) < this._text.Length) && (this._text.Substring(this._index - 1, this.TokenCodeEnd.Length) == this.TokenCodeEnd))
                    {
                        this._state = ParseState.Text;
                        this._currentfragment._length = (this._index + this.TokenCodeEnd.Length) - this._currentfragment._index;
                        this._index          += this.TokenCodeEnd.Length;
                        this._lineposition   += this.TokenCodeEnd.Length;
                        this._currentfragment = this.CreateFragment(MixedCodeDocumentFragmentType.Text);
                        this.SetPosition();
                    }
                    break;
                }
            }
            this._currentfragment._length = this._index - this._currentfragment._index;
        }
Ejemplo n.º 6
0
        public void RemoveAt(int index)
        {
            MixedCodeDocumentFragment fragment1 = (MixedCodeDocumentFragment)this._items[index];

            this._items.RemoveAt(index);
        }