internal void SavedIndexTokenDisposed(StringScannerSaveIndexToken token)
 {
     savedIndexTokens.Remove(token);
 }
 internal void SavedIndexTokenCreated(StringScannerSaveIndexToken token)
 {
     savedIndexTokens.Add(token, CurrentIndex);
 }
        /// <summary>
        /// Gets the string, starting at the specified saved index token, trimming start and end by the specified amount.
        /// </summary>
        /// <param name="token">The saved index token object.</param>
        /// <param name="trimStart">The amount to trim the start of the string.</param>
        /// <param name="trimEnd">The amount to trim the end of the string.</param>
        /// <returns></returns>
        public string GetString(StringScannerSaveIndexToken token, int trimStart = 0, int trimEnd = 0)
        {
            int start = GetIndex(token) + trimStart;

            return(Content.Substring(start, CurrentIndex - start - trimEnd));
        }
 /// <summary>
 /// Restores the saved index from the specified saved index token.
 /// </summary>
 /// <param name="token">The saved index token object.</param>
 public void RestoreIndex(StringScannerSaveIndexToken token)
 {
     CurrentIndex = GetIndex(token);
 }
 /// <summary>
 /// Gets the index relative to the specified saved index token.
 /// </summary>
 /// <param name="token">The saved index token object.</param>
 public int GetRelativeIndex(StringScannerSaveIndexToken token)
 {
     return(CurrentIndex - GetIndex(token));
 }
 /// <summary>
 /// Gets the index of the specified saved index token.
 /// </summary>
 /// <param name="token">The saved index token object.</param>
 public int GetIndex(StringScannerSaveIndexToken token)
 {
     return(savedIndexTokens[token]);
 }