/* * * Please visit http://radeox.org/ for updates and contact. * * --LICENSE NOTICE-- This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser * General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any * later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --LICENSE NOTICE-- */ package org.plog4u.wiki.macro.code; import java.util.HashMap; import java.util.HashSet; import org.radeox.macro.code.SourceCodeFormatter; /** * C# CodeFilter colourizes C# source code * */ public class CHashCodeFilter extends AbstractCPPBasedCodeFilter implements SourceCodeFormatter { private static HashMap KEYWORD_SET = new HashMap(); private static final String[] KEYWORDS = { "class", "abstract", "event", "new", "struct", "as", "explicit", "null", "switch", "base", "extern", "this", "false", "operator", "throw", "break", "finally", "out", "true", "fixed", "override", "try", "case", "float", "params", "typeof", "catch", "for", "private", "foreach", "protected", "checked", "goto", "public", "unchecked", "if", "readonly", "unsafe", "const", "implicit", "ref", "continue", "in", "return", "using", "virtual", "default", "interface", "sealed", "volatile", "delegate", "internal", "do", "is", "sizeof", "while", "lock", "stackalloc", "else", "static", "enum", "namespace", }; private static final String[] OBJECT_WORDS = { "object", "bool", "byte", "float", "uint", "char", "ulong", "ushort", "decimal", "int", "sbyte", "short", "void", "double", "long", "string" }; private static HashSet OBJECT_SET = new HashSet(); { for (int i = 0; i < KEYWORDS.length; i++) { //KEYWORD_SET.put(KEYWORDS[i], ""+KEYWORDS[i]+""); createHashMap(KEYWORD_SET, KEYWORDS[i]); } for (int i = 0; i < OBJECT_WORDS.length; i++) { OBJECT_SET.add(OBJECT_WORDS[i]); } } public CHashCodeFilter() { } /** * @return Returns the KEYWORD_SET. */ public HashMap getKeywordSet() { return KEYWORD_SET; } public String getName() { return "chash"; } /** * @return Returns the OBJECT_SET. */ public HashSet getObjectSet() { return OBJECT_SET; } }