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 '+' :
29  		case '>' :
30  			addToken( line.count, Token.KEYWORD1 );
31  			break;
32  		case '-' :
33  		case '<' :
34  			addToken( line.count, Token.KEYWORD2 );
35  			break;
36  		case '@' :
37  		case '*' :
38  			addToken( line.count, Token.KEYWORD3 );
39  			break;
40  		default :
41  			addToken( line.count, Token.NULL );
42  			break;
43  		}
44  		return Token.NULL;
45  	}
46  
47  	public boolean supportsMultilineTokens()
48  	{
49  		return false;
50  	}
51  }