Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.

1 /*******************************************************************************2 * Copyright (c) 2000, 2006 IBM Corporation and others.3 * All rights reserved. This program and the accompanying materials4 * are made available under the terms of the Eclipse Public License v1.05 * which accompanies this distribution, and is available at6 * http://www.eclipse.org/legal/epl-v10.html7 *8 * Contributors:9 * IBM Corporation - initial API and implementation10 *******************************************************************************/11 12 package org.eclipse.jface.text.rules;13 14 /**15 * Defines the interface for a rule used in the scanning of text for the purpose of16 * document partitioning or text styling. A predicate rule can only return one single17 * token after having successfully detected content. This token is called success token.18 * Also, it also returns a token indicating that this rule has not been successful.19 *20 * @see ICharacterScanner21 * @since 2.022 */23 publicinterface IPredicateRule extendsIRule {24 25 /**26 * Returns the success token of this predicate rule.27 *28 * @return the success token of this rule29 */30 IToken getSuccessToken();31 32 /**33 * Evaluates the rule by examining the characters available from34 * the provided character scanner. The token returned by this rule35 * returns <code>true</code> when calling <code>isUndefined</code>,36 * if the text that the rule investigated does not match the rule's requirements. Otherwise,37 * this method returns this rule's success token. If this rules relies on a text pattern38 * comprising a opening and a closing character sequence this method can also be called39 * when the scanner is positioned already between the opening and the closing sequence.40 * In this case, <code>resume</code> must be set to <code>true</code>.41 *42 * @param scanner the character scanner to be used by this rule43 * @param resume indicates that the rule starts working between the opening and the closing character sequence44 * @return the token computed by the rule45 */46 IToken evaluate(ICharacterScanner scanner, boolean resume);47 }48