4 // Copyright (C) 2005 Novell, Inc.
6 // Author: Wojciech Polak <wojciechpolak at gmail.com>
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.
29 using System
.Collections
;
35 namespace Beagle
.Filters
{
37 public class FilterScheme
: FilterSource
{
39 static string [] strKeyWords
= {"and", "begin", "case", "cond", "define",
40 "delay", "do", "else", "if", "lambda",
41 "let", "let*", "letrec", "or", "quasiquote",
42 "quote", "set!", "unquote", "unquote-splicing"};
44 static string [] strCommonProcedures
= {"abs", "append", "apply", "assoc", "assq",
45 "assv", "caar", "cadr", "car", "cdr",
46 "ceiling", "cons", "denominator", "display",
47 "eval", "exp", "expt", "floor", "gcd", "lcm",
48 "length", "list-ref", "list-tail", "log",
49 "map", "max", "member", "memq", "memv", "min",
50 "modulo", "newline", "not", "numerator",
51 "quotient", "rationalize", "read", "remainder",
52 "reverse", "round", "sqrt", "string", "truncate",
55 public FilterScheme ()
57 AddSupportedFlavor (FilterFlavor
.NewFromMimeType ("text/x-scheme"));
60 override protected void DoOpen (FileInfo info
)
62 foreach (string keyword
in strKeyWords
)
63 KeyWordsHash
[keyword
] = true;
65 foreach (string keyword
in strCommonProcedures
)
66 KeyWordsHash
[keyword
] = true;
68 SrcLangType
= LangType
.Lisp_Style
;
71 override protected void DoPull ()
73 string str
= TextReader
.ReadLine ();
81 // TO DO: Add Emacs Lisp (FilterEmacsLisp), Common Lisp (FilterCommonLisp).