|
|
|||||
Evan Summers's BlogJava HighlighterPosted by evanx on May 08, 2007 at 02:10 AM | Comments (0)In the Hyper Text Processor prequel, we processed half-baked HTML for this Foundation Beans series of articles. Now let's meet the QHyperJavaProcessor, which highlights Java code in HTML pre blocks.
We split up the Java text into an array of string tokens, using the following delimiter tokens, which include Java keywords to be highlighted.
public class QHyperJavaProcessor { static final String[] keywords = new String[] { "package", "import", "static", "final", "abstract", "synchronized", "transient", "default", "class", "interface", "@interface", "enum", "extends", "implements", "public", "private", "protected", "true", "false", "null", "instanceof", "void", "boolean", "int", "char", "long", "throws", "throw", "try", "catch", "finally", "new", "this", "super", "if", "else", "for", "while", "continue", "break", "return" }; ... }
Bookmark blog post: CommentsComments are listed in date ascending order (oldest first) | Post Comment | |||||
|
|