01: /*
02: * PatchTokenMarker.java - DIFF patch token marker
03: * Copyright (C) 1999 Slava Pestov
04: *
05: * You may use and modify this package for any purpose. Redistribution is
06: * permitted, in both source and binary form, provided that this notice
07: * remains intact in all source distributions of this package.
08: */
09:
10: package org.syntax.jedit.tokenmarker;
11:
12: import javax.swing.text.Segment;
13:
14: /**
15: * Patch/diff token marker.
16: *
17: * @author Slava Pestov
18: * @version $Id: PatchTokenMarker.java 3074 2004-11-08 04:24:58Z bquig $
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: }
|