01: package net.xoetrope.builder.editor.syntaxhighlight;
02:
03: /*
04: * PatchTokenMarker.java - DIFF patch token marker
05: * Copyright (C) 1999 Slava Pestov
06: *
07: * You may use and modify this package for any purpose. Redistribution is
08: * permitted, in both source and binary form, provided that this notice
09: * remains intact in all source distributions of this package.
10: */
11:
12: import javax.swing.text.Segment;
13:
14: /**
15: * Patch/diff token marker.
16: *
17: * @author Slava Pestov
18: * @version $Id: PatchTokenMarker.java,v 1.22 2005/01/05 17:20:49 luano Exp $
19: */
20: public class PatchTokenMarker extends TokenMarker {
21: public byte markTokensImpl(byte token, Segment line, int lineIndex) {
22: if (line.count == 0)
23: return Token.NULL;
24: switch (line.array[line.offset]) {
25: case '+':
26: case '>':
27: addToken(line.count, Token.KEYWORD1);
28: break;
29: case '-':
30: case '<':
31: addToken(line.count, Token.KEYWORD2);
32: break;
33: case '@':
34: case '*':
35: addToken(line.count, Token.KEYWORD3);
36: break;
37: default:
38: addToken(line.count, Token.NULL);
39: break;
40: }
41: return Token.NULL;
42: }
43:
44: public boolean supportsMultilineTokens() {
45: return false;
46: }
47: }
|