1 /******************************************************************************* 2 * Copyright (c) 2000, 2005 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.jface.text.rules; 12 13 14 /** 15 * Defines the interface of a character scanner used by rules. 16 * Rules may request the next character or ask the character 17 * scanner to unread the last read character. 18 */ 19 public interface ICharacterScanner { 20 21 /** 22 * The value returned when this scanner has read EOF. 23 */ 24 public static final int EOF= -1; 25 26 /** 27 * Provides rules access to the legal line delimiters. The returned 28 * object may not be modified by clients. 29 * 30 * @return the legal line delimiters 31 */ 32 char[][] getLegalLineDelimiters(); 33 34 /** 35 * Returns the column of the character scanner. 36 * 37 * @return the column of the character scanner 38 */ 39 int getColumn(); 40 41 /** 42 * Returns the next character or EOF if end of file has been reached 43 * 44 * @return the next character or EOF 45 */ 46 int read(); 47 48 /** 49 * Rewinds the scanner before the last read character. 50 */ 51 void unread(); 52 } 53