package eg.syntax;

/**
 * Syntax coloring for Java
 */
public class JavaColoring implements Colorable {

   private final static String[] JAVA_KEYWORDS = {
     "abstract", "assert",
     "break", "boolean", "Boolean", "byte",
     "catch", "case","const","continue", "class", "char",
     "default", "do", "double",
     "else", "enum", "extends",
     "false", "finally", "final", "float", "for",
     "if", "implements", "import", "instanceof", "int", "interface",
     "long",
     "native", "new", "null",
     "package", "private", "protected", "public",
     "return",
     "strictfp", "switch", "synchronized", "short", "static", "super",
     "String",
     "this", "throw", "throws", "transient", "true", "try",
     "void", "volatile",
     "while"
   };

   private final static String[] JAVA_ANNOTATIONS = {
      "@Override", "@Deprecated", "@SuppressWarnings", "@SafeVarargs"
   };

   @Override
   public void color(Lexer lex) {
      if (!lex.isInBlock(SyntaxUtils.BLOCK_CMNT_START, SyntaxUtils.BLOCK_CMNT_END)) {
         lex.setCharAttrBlack();
         lex.keywordsBlue(JAVA_ANNOTATIONS, false);
         lex.keywordsRed(JAVA_KEYWORDS, true);
         lex.bracketsBlue();
         lex.bracesGray();
         lex.quotedText();
         lex.lineComments(SyntaxUtils.LINE_CMNT, '\0');   
      }
      lex.blockComments(SyntaxUtils.BLOCK_CMNT_START, SyntaxUtils.BLOCK_CMNT_END);
   }
}

@@ -884,16 +884,46 @@
 Varargs%22
+,%0A      %22@FunctionalInterface%22
 %0A   %7D;%0A%0A

add annotation