Ejemplo n.º 1
0
        /// <summary>
        /// Replaces all occurrences of a specified String, with another specified string.
        /// Before oldValue must not follow specified prefix - string.
        /// </summary>
        /// <param name="prefix">Prefix - string.</param>
        /// <param name="oldValue">A String to be replaced.</param>
        /// <param name="newValue">A String to replace all occurrences of oldValue.</param>
        /// <returns>Replaced string.</returns>
        public void ReplaceWithNotEqualPrefix(StiTokenType prefix, string oldValue, string newValue)
        {
            this.Reset();

            StiToken prefixToken = this.GetToken();

            if (prefixToken.Type == StiTokenType.EOF)
            {
                return;
            }
            StiToken token = null;

            do
            {
                token = this.GetToken();
                if (token.Type == StiTokenType.Ident &&
                    prefixToken.Type != prefix &&
                    ((string)token.Data) == oldValue)
                {
                    text = text.Replace(oldValue, newValue, token.Index, token.Length);
                    this.positionInText += newValue.Length;
                }
                prefixToken = token;
            }while (token.Type != StiTokenType.EOF);
            baseText = text.ToString();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates an object of the type StiToken that contains an object.
 /// </summary>
 /// <param name="type">Type Token</param>
 /// <param name="index">The Beginning Token in text.</param>
 /// <param name="length">The Length Token.</param>
 /// <param name="obj">Object for initializing.</param>
 public StiToken(StiTokenType type, int index, int length, object obj) : this(type, index, length)
 {
     this.Data = obj;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates an object of the type StiToken that contains the value of the string.
 /// </summary>
 /// <param name="type">Type Token.</param>
 /// <param name="index">The Beginning Token in text.</param>
 /// <param name="length">The Length Token.</param>
 /// <param name="stringValue">String for initializing.</param>
 public StiToken(StiTokenType type, int index, int length, string stringValue) : this(type, index, length)
 {
     this.Data = stringValue;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Creates a new object of the type StiToken.
 /// </summary>
 /// <param name="type">Type Token.</param>
 /// <param name="index">The Beginning Token in text.</param>
 /// <param name="length">The Length Token.</param>
 /// <param name="charValue">Char for initializing</param>
 public StiToken(StiTokenType type, int index, int length, char charValue) : this(type, index, length)
 {
     this.Data = charValue;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Creates a new object of the type StiToken.
 /// </summary>
 /// <param name="type">Type Token.</param>
 /// <param name="index">The Beginning Token in text.</param>
 /// <param name="length">The Length Token.</param>
 public StiToken(StiTokenType type, int index, int length)
 {
     this.type   = type;
     this.index  = index;
     this.length = length;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Create a new instance StiToken.
 /// </summary>
 /// <param name="type">Type Token.</param>
 public StiToken(StiTokenType type) : this(type, 0, 0)
 {
 }
Ejemplo n.º 7
0
 public StiToken()
 {
     this.Type = StiTokenType.Empty;
 }
Ejemplo n.º 8
0
 public StiToken(StiTokenType type)
 {
     this.Type = type;
 }
Ejemplo n.º 9
0
 public StiToken(StiTokenType type, int position)
 {
     this.Type     = type;
     this.Position = position;
 }
Ejemplo n.º 10
0
 public StiToken(StiTokenType type, int position, int length)
 {
     this.Type     = type;
     this.Position = position;
     this.Length   = length;
 }