Dont throw EncodingFoundException unless asked to. Should remove the occassional...
[beagle.git] / Filters / FilterBoo.cs
blobf69585f7a64d01276b5ad0cf46519a1d4ec471db
1 //
2 // FilterBoo.cs
3 //
4 // Paul Betts (Paul.Betts@Gmail.com)
5 // Copyright (C) 2006 Novell Inc.
6 //
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining a
10 // copy of this software and associated documentation files (the "Software"),
11 // to deal in the Software without restriction, including without limitation
12 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 // and/or sell copies of the Software, and to permit persons to whom the
14 // Software is furnished to do so, subject to the following conditions:
16 // The above copyright notice and this permission notice shall be included in
17 // all copies or substantial portions of the Software.
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 // DEALINGS IN THE SOFTWARE.
28 using System;
29 using System.Collections;
30 using System.IO;
31 using System.Text;
33 using Beagle.Daemon;
35 namespace Beagle.Filters {
37 public class FilterBoo : FilterSource {
39 static string[] strKeyWords = {"abstract", "and", "as", "ast", "break", "continue",
40 "callable", "cast", "char", "class", "constructor",
41 "def", "destructor", "do", "elif", "else", "ensure",
42 "enum", "event", "except", "failure", "final", "from",
43 "for", "false", "get", "given", "goto", "import", "interface",
44 "internal", "is", "isa", "if", "in", "not", "null",
45 "of", "or", "otherwise", "override", "pass", "namespace",
46 "partial", "public", "protected", "private", "raise",
47 "ref", "return", "retry", "set", "self", "static",
48 "struct", "try", "transient", "true", "typeof",
49 "unless", "virtual", "when", "while", "yield"};
51 public FilterBoo ()
53 AddSupportedFlavor (FilterFlavor.NewFromMimeType ("text/x-boo"));
56 override protected void DoOpen (FileInfo info)
58 foreach (string keyword in strKeyWords)
59 KeyWordsHash [keyword] = true;
60 SrcLangType = LangType.Python_Style;
63 override protected void DoPull ()
65 string str = TextReader.ReadLine ();
66 if (str == null)
67 Finished ();
68 else
69 ExtractTokens (str);