KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > gjt > sp > jedit > syntax > TokenHandler


1 /*
2  * TokenHandler.java - Token markers send tokens to implementations of
3  * this class
4  * :tabSize=8:indentSize=8:noTabs=false:
5  * :folding=explicit:collapseFolds=1:
6  *
7  * Copyright (C) 2002 Slava Pestov
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22  */

23
24 package org.gjt.sp.jedit.syntax;
25
26 import javax.swing.text.Segment JavaDoc;
27
28 /**
29  * Token markers send tokens to implementations of this interface.
30  *
31  * @author Slava Pestov
32  * @version $Id: TokenHandler.java 4902 2003-10-26 19:43:58Z spestov $
33  * @since jEdit 4.1pre1
34  */

35 public interface TokenHandler
36 {
37     /**
38      * Called by the token marker when a syntax token has been parsed.
39      * @param seg The segment containing the text
40      * @param id The token type (one of the constants in the
41      * {@link Token} class).
42      * @param offset The start offset of the token
43      * @param length The number of characters in the token
44      * @param context The line context
45      * @since jEdit 4.2pre3
46      */

47     public void handleToken(Segment JavaDoc seg, byte id, int offset, int length,
48         TokenMarker.LineContext context);
49
50     /**
51      * The token handler can compare this object with the object
52      * previously given for this line to see if the token type at the end
53      * of the line has changed (meaning subsequent lines might need to be
54      * retokenized).
55      * @since jEdit 4.2pre6
56      */

57     public void setLineContext(TokenMarker.LineContext lineContext);
58 }
59
Popular Tags