1 19 20 package org.netbeans.api.java.lexer; 21 22 import java.util.Collection ; 23 import java.util.EnumSet ; 24 import java.util.Map ; 25 import org.netbeans.api.lexer.Language; 26 import org.netbeans.api.lexer.TokenId; 27 import org.netbeans.lib.java.lexer.JavadocLexer; 28 import org.netbeans.spi.lexer.LanguageHierarchy; 29 import org.netbeans.spi.lexer.Lexer; 30 import org.netbeans.spi.lexer.LexerRestartInfo; 31 32 38 public enum JavadocTokenId implements TokenId { 39 40 IDENT("comment"), 41 TAG("javadoc-tag"), 42 HTML_TAG("html-tag"), 43 DOT("comment"), 44 HASH("comment"), 45 OTHER_TEXT("comment"); 46 47 private final String primaryCategory; 48 49 JavadocTokenId() { 50 this(null); 51 } 52 53 JavadocTokenId(String primaryCategory) { 54 this.primaryCategory = primaryCategory; 55 } 56 57 public String primaryCategory() { 58 return primaryCategory; 59 } 60 61 private static final Language<JavadocTokenId> language = new LanguageHierarchy<JavadocTokenId>() { 62 @Override 63 protected Collection <JavadocTokenId> createTokenIds() { 64 return EnumSet.allOf(JavadocTokenId.class); 65 } 66 67 @Override 68 protected Map <String ,Collection <JavadocTokenId>> createTokenCategories() { 69 return null; } 71 72 @Override 73 protected Lexer<JavadocTokenId> createLexer(LexerRestartInfo<JavadocTokenId> info) { 74 return new JavadocLexer(info); 75 } 76 77 @Override 78 protected String mimeType() { 79 return "text/x-javadoc"; 80 } 81 }.language(); 82 83 public static Language<JavadocTokenId> language() { 84 return language; 85 } 86 87 } 88 | Popular Tags |