initial contribution
[phpeclipse.git] / archive / org.plog4u.wiki / src / org / plog4u / wiki / macro / code / SqlCodeFilter.java
diff --git a/archive/org.plog4u.wiki/src/org/plog4u/wiki/macro/code/SqlCodeFilter.java b/archive/org.plog4u.wiki/src/org/plog4u/wiki/macro/code/SqlCodeFilter.java
new file mode 100644 (file)
index 0000000..e1ace3b
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * This file is part of "SnipSnap Radeox Rendering Engine".
+ *
+ * Copyright (c) 2002 Stephan J. Schmidt, Matthias L. Jugel
+ * All Rights Reserved.
+ *
+ * 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 org.radeox.macro.code.DefaultRegexCodeFormatter;
+import org.radeox.macro.code.SourceCodeFormatter;
+
+/*
+ * SqlCodeFilter colourizes SQL source code
+ *
+ * @author stephan
+ * @team sonicteam
+ * @version $Id: SqlCodeFilter.java,v 1.1 2004-12-24 11:11:13 axelcl Exp $
+ */
+
+public class SqlCodeFilter extends DefaultRegexCodeFormatter implements SourceCodeFormatter {
+
+  private static final String KEYWORDS =
+      "\\b(SELECT|DELETE|UPDATE|WHERE|FROM|GROUP|BY|HAVING)\\b";
+
+  private static final String OBJECTS =
+      "\\b(VARCHAR)" +
+      "\\b";
+
+  private static final String QUOTES =
+      "\"(([^\"\\\\]|\\.)*)\"";
+
+
+  public SqlCodeFilter() {
+    super(QUOTES, "<b><font color=\"#2A00FF\">\"$1\"</font></b>");
+    addRegex(OBJECTS, "<b><font color=\"#7F9FBF\">$1</font></b>");
+    addRegex(KEYWORDS, "<b><font color=\"#750055\">$1</font></b>");
+  }
+
+
+  public String getName() {
+    return "sql";
+  }
+
+}
\ No newline at end of file