示例#1
0
        public virtual int Mark()
        {
            if (this.markers == null)
            {
                this.markers = new List <CharStreamState>();
                this.markers.Add(null);
            }
            this.markDepth++;
            CharStreamState charStreamState = null;

            if (this.markDepth >= this.markers.Count)
            {
                charStreamState = new CharStreamState();
                this.markers.Add(charStreamState);
            }
            else
            {
                charStreamState = this.markers[this.markDepth];
            }
            charStreamState.p    = this.p;
            charStreamState.line = this.line;
            charStreamState.charPositionInLine = this.charPositionInLine;
            this.lastMarker = this.markDepth;
            return(this.markDepth);
        }
示例#2
0
        public virtual void Rewind(int m)
        {
            if (m < 0)
            {
                throw new ArgumentOutOfRangeException();
            }
            CharStreamState charStreamState = this.markers[m];

            this.Seek(charStreamState.p);
            this.line = charStreamState.line;
            this.charPositionInLine = charStreamState.charPositionInLine;
            this.Release(m);
        }