/// <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(); }
/// <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; }
/// <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; }
/// <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; }
/// <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; }
/// <summary> /// Create a new instance StiToken. /// </summary> /// <param name="type">Type Token.</param> public StiToken(StiTokenType type) : this(type, 0, 0) { }
public StiToken() { this.Type = StiTokenType.Empty; }
public StiToken(StiTokenType type) { this.Type = type; }
public StiToken(StiTokenType type, int position) { this.Type = type; this.Position = position; }
public StiToken(StiTokenType type, int position, int length) { this.Type = type; this.Position = position; this.Length = length; }