initial contribution
[phpeclipse.git] / archive / org.plog4u.wiki / src / org / plog4u / wiki / macro / code / PHPCodeFilter.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  * Java CodeFilter colourizes C# source code
25  *  
26  */
27 public class PHPCodeFilter extends AbstractCPPBasedCodeFilter implements SourceCodeFormatter {
28
29   private static HashMap KEYWORD_SET = new HashMap();
30
31   private static final String[] KEYWORDS =
32     {
33       "if",
34       "elseif",
35       "else",
36       "endif",
37       "for",
38       "endfor",
39       "while",
40       "endwhile",
41       "switch",
42       "case",
43       "endswitch",
44       "break",
45       "continue",
46       "return",
47       "include",
48       "include_once",
49       "require",
50       "require_once",
51       "function",
52       "class",
53       "new",
54       "do",
55       "old_function",
56       "default",
57       "global",
58       "static",
59       "foreach",
60       "endforeach",
61       "extends",
62       "empty",
63       "array",
64       "echo",
65       "var",
66       "as",
67       "print",
68       "unset",
69       "exit",
70       "and",
71       "or",
72       "xor",
73       "list",
74       "null",
75       "false",
76       "true",
77       "abstract",
78       "catch",
79       "finally",
80       "try",
81       "private",
82       "protected",
83       "public",
84       "interface",
85       "implements",
86       "instanceof",
87       "super",
88       "throw",
89       "const",
90       "declare",
91       "enddeclare",
92       "eval",
93       "use",
94       "isset",
95       "final" };
96
97   {
98     for (int i = 0; i < KEYWORDS.length; i++) {
99       //KEYWORD_SET.put(KEYWORDS[i], ""+KEYWORDS[i]+"");
100       createHashMap(KEYWORD_SET, KEYWORDS[i]);
101     }
102
103   }
104
105   public PHPCodeFilter() {
106   }
107
108   /**
109    * @return Returns the KEYWORD_SET.
110    */
111   public HashMap getKeywordSet() {
112     return KEYWORD_SET;
113   }
114
115   public String getName() {
116     return "php";
117   }
118
119   /**
120    * @return Returns the OBJECT_SET.
121    */
122   public HashSet getObjectSet() {
123     return null;
124   }
125
126   /*
127    * (non-Javadoc)
128    * 
129    * @see net.sourceforge.phpeclipse.wiki.macro.code.AbstractCPPBasedCodeFilter#isKeywordLowerCase()
130    */
131   public boolean isKeywordLowerCase() {
132     return false;
133   }
134   
135   /**
136    *  
137    */
138   public boolean isPHPTag() {
139     return true;
140   }
141 }