initial contribution
[phpeclipse.git] / archive / org.plog4u.wiki / src / org / plog4u / wiki / macro / code / CHashCodeFilter.java
1 /*
2  * 
3  * Please visit http://radeox.org/ for updates and contact.
4  * 
5  * --LICENSE NOTICE-- This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser
6  * General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any
7  * later version.
8  * 
9  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
11  * 
12  * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free
13  * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --LICENSE NOTICE--
14  */
15
16 package org.plog4u.wiki.macro.code;
17
18 import java.util.HashMap;
19 import java.util.HashSet;
20
21 import org.radeox.macro.code.SourceCodeFormatter;
22
23 /**
24  * C# CodeFilter colourizes C# source code
25  *  
26  */
27 public class CHashCodeFilter extends AbstractCPPBasedCodeFilter implements SourceCodeFormatter {
28
29   private static HashMap KEYWORD_SET = new HashMap();
30
31   private static final String[] KEYWORDS =
32     {
33       "class",
34       "abstract",
35       "event",
36       "new",
37       "struct",
38       "as",
39       "explicit",
40       "null",
41       "switch",
42       "base",
43       "extern",
44       "this",
45       "false",
46       "operator",
47       "throw",
48       "break",
49       "finally",
50       "out",
51       "true",
52       "fixed",
53       "override",
54       "try",
55       "case",
56       "float",
57       "params",
58       "typeof",
59       "catch",
60       "for",
61       "private",
62       "foreach",
63       "protected",
64       "checked",
65       "goto",
66       "public",
67       "unchecked",
68       "if",
69       "readonly",
70       "unsafe",
71       "const",
72       "implicit",
73       "ref",
74       "continue",
75       "in",
76       "return",
77       "using",
78       "virtual",
79       "default",
80       "interface",
81       "sealed",
82       "volatile",
83       "delegate",
84       "internal",
85       "do",
86       "is",
87       "sizeof",
88       "while",
89       "lock",
90       "stackalloc",
91       "else",
92       "static",
93       "enum",
94       "namespace",
95       };
96
97   private static final String[] OBJECT_WORDS =
98     {
99       "object",
100       "bool",
101       "byte",
102       "float",
103       "uint",
104       "char",
105       "ulong",
106       "ushort",
107       "decimal",
108       "int",
109       "sbyte",
110       "short",
111       "void",
112       "double",
113       "long",
114       "string" };
115   
116   private static HashSet OBJECT_SET = new HashSet();
117
118   {
119     for (int i = 0; i < KEYWORDS.length; i++) {
120       //KEYWORD_SET.put(KEYWORDS[i], ""+KEYWORDS[i]+"");
121       createHashMap(KEYWORD_SET, KEYWORDS[i]);
122     }
123     for (int i = 0; i < OBJECT_WORDS.length; i++) {
124       OBJECT_SET.add(OBJECT_WORDS[i]);
125     }
126   }
127
128   public CHashCodeFilter() {
129   }
130
131   /**
132    * @return Returns the KEYWORD_SET.
133    */
134   public HashMap getKeywordSet() {
135     return KEYWORD_SET;
136   }
137
138   public String getName() {
139     return "chash";
140   }
141
142   /**
143    * @return Returns the OBJECT_SET.
144    */
145   public HashSet getObjectSet() {
146     return OBJECT_SET;
147   }
148
149 }