Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: c7f993f8f1af6422a818223cbc5a25e48590bb2d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*******************************************************************************
 * Copyright (c) 2017 Red Hat Inc. and others
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Sopot Cela (Red Hat Inc.)
 *******************************************************************************/
package org.eclipse.team.internal.genericeditor.diff.extension.rules;

import org.eclipse.jface.text.rules.*;

public class StartOfLineRule extends SingleLineRule {

	public StartOfLineRule(String startSequence, String endSequence, IToken token) {
		super(startSequence, endSequence, token);
	}

	@Override
	public IToken evaluate(ICharacterScanner scanner) {
		scanner.unread();
		int c = scanner.read();
		if ((c == '\n') || (c == -1)) {
			return super.evaluate(scanner);
		}
		return Token.UNDEFINED;
	}
}

Back to the top