View Javadoc

1   /*
2    * PatchTokenMarker.java - DIFF patch token marker
3    * Copyright (C) 1999 Slava Pestov
4    *
5    * You may use and modify this package for any purpose. Redistribution is
6    * permitted, in both source and binary form, provided that this notice
7    * remains intact in all source distributions of this package.
8    */
9   
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,v 1.7 1999/12/13 03:40:30 sp Exp $
19   */
20  public class PatchTokenMarker extends TokenMarker
21  {
22  	public byte markTokensImpl(byte token, Segment 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  }