01: /*
02: * TokenHandler.java - Token markers send tokens to implementations of
03: * this class
04: * :tabSize=8:indentSize=8:noTabs=false:
05: * :folding=explicit:collapseFolds=1:
06: *
07: * Copyright (C) 2002 Slava Pestov
08: *
09: * 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;
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: * Called by the token marker when a syntax token has been parsed.
38: * @param seg The segment containing the text
39: * @param id The token type (one of the constants in the
40: * {@link Token} class).
41: * @param offset The start offset of the token
42: * @param length The number of characters in the token
43: * @param context The line context
44: * @since jEdit 4.2pre3
45: */
46: public void handleToken(Segment seg, byte id, int offset,
47: int length, TokenMarker.LineContext context);
48:
49: /**
50: * The token handler can compare this object with the object
51: * previously given for this line to see if the token type at the end
52: * of the line has changed (meaning subsequent lines might need to be
53: * retokenized).
54: * @since jEdit 4.2pre6
55: */
56: public void setLineContext(TokenMarker.LineContext lineContext);
57: }
|