KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > lexer > demo > handcoded > plain > PlainLanguage


1
2 package org.netbeans.modules.lexer.demo.handcoded.plain;
3
4 import org.netbeans.api.lexer.Lexer;
5 import org.netbeans.api.lexer.TokenId;
6 import org.netbeans.spi.lexer.AbstractLanguage;
7
8 public class PlainLanguage extends AbstractLanguage {
9
10     /** Lazily initialized singleton instance of this language. */
11     private static PlainLanguage INSTANCE;
12
13     /** @return singleton instance of this language. */
14     public static synchronized PlainLanguage get() {
15         if (INSTANCE == null)
16             INSTANCE = new PlainLanguage();
17
18         return INSTANCE;
19     }
20
21     public static final int TEXT_INT = 1;
22
23
24     public static final TokenId TEXT = new TokenId("text", TEXT_INT); // A line of text
25

26     PlainLanguage() {
27     }
28
29     public Lexer createLexer() {
30         return new PlainLexer();
31     }
32
33 }
34
Popular Tags