? 317277.fix ? filter-shellscript.diff ? filterdoc-wv-gsf.diff ? less ? mem-opt.diff ? perf-test.diff ? try-this-one.diff ? Filters/FilterKWord.cs ? Filters/FilterSource.cs.temp ? Filters/another-mem-opt.diff ? beagled/outfile ? beagled/outfile.new Index: Filters/FilterSource.cs =================================================================== RCS file: /cvs/gnome/beagle/Filters/FilterSource.cs,v retrieving revision 1.22 diff -u -p -r1.22 FilterSource.cs --- Filters/FilterSource.cs 25 Nov 2005 16:24:33 -0000 1.22 +++ Filters/FilterSource.cs 26 Nov 2005 18:58:37 -0000 @@ -79,10 +79,8 @@ namespace Beagle.Filters { // True, if it is a valid word that can be added to the pool. private bool AppendToToken (char ch, int index, int length) { - if (ch == ' ' && - SrcLangType == LangType.Shell_Style) { + if (ch == ' ') return true; - } if (Char.IsLetter (ch) || Char.IsDigit (ch) || @@ -129,7 +127,7 @@ namespace Beagle.Filters { case "(*": if (SrcLineType == LineType.None) { SrcLineType = LineType.BlockComment; - token.Remove (0, token.Length); + token.Length = 0; } else token.Append (splCharSeq); splCharSeq = ""; @@ -140,7 +138,7 @@ namespace Beagle.Filters { SrcLineType = LineType.None; token.Append (" "); AppendText (token.ToString()); - token.Remove (0, token.Length); + token.Length = 0; } else if (SrcLineType != LineType.None) token.Append (splCharSeq); splCharSeq = ""; @@ -149,7 +147,7 @@ namespace Beagle.Filters { case "{": if (SrcLineType == LineType.None) { SrcLineType = LineType.BlockComment; - token.Remove (0, token.Length); + token.Length = 0; } else token.Append (splCharSeq); splCharSeq = ""; @@ -160,7 +158,7 @@ namespace Beagle.Filters { SrcLineType = LineType.None; token.Append (" "); AppendText (token.ToString()); - token.Remove (0, token.Length); + token.Length = 0; } else if (SrcLineType != LineType.None) token.Append (splCharSeq); splCharSeq = ""; @@ -168,7 +166,7 @@ namespace Beagle.Filters { case "//": if (SrcLineType == LineType.None) { SrcLineType = LineType.SingleLineComment; - token.Remove (0, token.Length); + token.Length = 0; } else token.Append (splCharSeq); splCharSeq = ""; @@ -177,7 +175,7 @@ namespace Beagle.Filters { case "/*": if (SrcLineType == LineType.None) { SrcLineType = LineType.BlockComment; - token.Remove (0, token.Length); + token.Length = 0; } else token.Append (splCharSeq); splCharSeq = ""; @@ -188,7 +186,7 @@ namespace Beagle.Filters { SrcLineType = LineType.None; token.Append (" "); AppendText (token.ToString()); - token.Remove (0, token.Length); + token.Length = 0; } else if (SrcLineType != LineType.None) token.Append (splCharSeq); splCharSeq = ""; @@ -201,7 +199,7 @@ namespace Beagle.Filters { (str[index] == '%' && SrcLangType == LangType.Matlab_Style)) { if (SrcLineType == LineType.None) { SrcLineType = LineType.SingleLineComment; - token.Remove (0, token.Length); + token.Length = 0; } else token.Append (str[index]); } @@ -225,11 +223,11 @@ namespace Beagle.Filters { SrcLineType = LineType.None; token.Append (" "); AppendText (token.ToString()); - token.Remove (0, token.Length); + token.Length = 0; } else { StrConstIdentifier = str.Substring (index, 3); SrcLineType = LineType.StringConstant; - token.Remove (0, token.Length); + token.Length = 0; index += 2; } @@ -248,12 +246,12 @@ namespace Beagle.Filters { SrcLineType = LineType.None; token.Append (" "); AppendText (token.ToString()); - token.Remove (0, token.Length); + token.Length = 0; } else if (SrcLineType == LineType.None) { StrConstIdentifier = str.Substring (index, 1); SrcLineType = LineType.StringConstant; - token.Remove (0, token.Length); + token.Length = 0; } else token.Append (str[index]); splCharSeq = ""; @@ -279,15 +277,18 @@ namespace Beagle.Filters { continue; } } - token = token.Replace(" ", ""); + //token = token.Replace(" ", ""); if (token.Length > 0) { - string tok = token.ToString(); + string tok; if (SrcLangType == LangType.Fortran_Style) tok = token.ToString().ToLower(); + else + tok = token.ToString (); if (!KeyWordsHash.Contains (tok)) { - token.Append (" "); - if (!Char.IsDigit (token[0])) - AppendText (token.ToString()); + if (!Char.IsDigit (token[0])) { + AppendText (tok); + AppendWhiteSpace (tok); + } } } // reset the token Index: beagled/Filter.cs =================================================================== RCS file: /cvs/gnome/beagle/beagled/Filter.cs,v retrieving revision 1.37 diff -u -p -r1.37 Filter.cs --- beagled/Filter.cs 25 Nov 2005 22:42:17 -0000 1.37 +++ beagled/Filter.cs 26 Nov 2005 18:58:37 -0000 @@ -217,7 +217,6 @@ namespace Beagle.Daemon { if (str.IndexOf ('\n') > -1) { lines = str.Split ('\n'); for (i = 0; i < lines.Length; i++) { - line = lines[i].Trim(); if (line.Length > 0) { ReallyAppendText (line, null); AppendStructuralBreak ();