KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jedit > syntax > PatchTokenMarker


1 package org.jedit.syntax;
2
3 /*
4  * PatchTokenMarker.java - DIFF patch token marker
5  * Copyright (C) 1999 Slava Pestov
6  *
7  * You may use and modify this package for any purpose. Redistribution is
8  * permitted, in both source and binary form, provided that this notice
9  * remains intact in all source distributions of this package.
10  */

11
12 import javax.swing.text.Segment JavaDoc;
13
14 /**
15  * Patch/diff token marker.
16  *
17  * @author Slava Pestov
18  * @version $Id: PatchTokenMarker.java,v 1.1 2003/12/14 16:29:49 daggerrz Exp $
19  */

20 public class PatchTokenMarker extends TokenMarker
21 {
22    public byte markTokensImpl(byte token, Segment JavaDoc line, int lineIndex)
23    {
24       if(line.count == 0)
25          return Token.NULL;
26       switch(line.array[line.offset])
27       {
28       case '+': case '>':
29          addToken(line.count,Token.KEYWORD1);
30          break;
31       case '-': case '<':
32          addToken(line.count,Token.KEYWORD2);
33          break;
34       case '@': 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    {
46       return false;
47    }
48 }
49
Popular Tags