These class adds remove token capability to the CommonTokenStream.
Inheritance: Antlr.Runtime.CommonTokenStream
 /// <summary>
 /// Removes a token using the enhanced token stream class.
 /// </summary>
 /// <param name="sql"></param>
 /// <param name="position"></param>
 /// <returns></returns>
 private CommonTokenStream RemoveToken(string sql, SnapshotPoint snapPos)
 {
   MemoryStream ms = new MemoryStream(ASCIIEncoding.ASCII.GetBytes(sql));
   CaseInsensitiveInputStream input = new CaseInsensitiveInputStream(ms);
   //ANTLRInputStream input = new ANTLRInputStream(ms);
   Version ver = LanguageServiceUtil.GetVersion(LanguageServiceUtil.GetConnection().ServerVersion);
   MySQLLexer lexer = new MySQLLexer(input);
   lexer.MySqlVersion = ver;
   TokenStreamRemovable tokens = new TokenStreamRemovable(lexer);      
   IToken tr = null;
   int position = snapPos.Position;
   tokens.Fill();      
   if (!char.IsWhiteSpace(snapPos.GetChar()))
   {
     foreach (IToken t in tokens.GetTokens())
     {
       if ((t.StartIndex <= position) && (t.StopIndex >= position))
       {
         tr = t;
         break;
       }
     }
     tokens.Remove(tr);
   }
   return tokens;
 }    
 private CommonTokenStream RemoveToken(string sql, int position)
 {
   MemoryStream ms = new MemoryStream(ASCIIEncoding.ASCII.GetBytes(sql));
   CaseInsensitiveInputStream input = new CaseInsensitiveInputStream(ms);
   //ANTLRInputStream input = new ANTLRInputStream(ms);
   MySQL51Lexer lexer = new MySQL51Lexer(input);
   TokenStreamRemovable tokens = new TokenStreamRemovable(lexer);
   //CommonTokenStream tokens = new CommonTokenStream(lexer);
   IToken tr = null;
   position--;   // we want a zero-based index.
   foreach (IToken t in tokens.GetTokens())
   {
     if ((t.StartIndex <= position) && (t.StopIndex >= position))
     {
       tr = t;
       break;
     }
   }
   tokens.Remove(tr);
   return tokens;
 }
 public void TestTokenRemove()
 {
   string sql = "select *, a, c, d from table1 where a is null";
   MemoryStream ms = new MemoryStream(ASCIIEncoding.ASCII.GetBytes(sql));
   CaseInsensitiveInputStream input = new CaseInsensitiveInputStream(ms);
   //ANTLRInputStream input = new ANTLRInputStream(ms);
   MySQLLexer lexer = new MySQLLexer(input);
   MySql.Parser.TokenStreamRemovable tsr = new MySql.Parser.TokenStreamRemovable(lexer);
   tsr.Fill();
   List<IToken> tokens = tsr.GetTokens();
   IToken removed = null;
   foreach( IToken t in tokens )
   {
     if (t.Text == "d")
     {
       removed = t;
       break;
     }
   }
   tsr.Remove(removed);
   tokens = tsr.GetTokens();
 }