129
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2000, 2006 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 * Port to the D programming language:
|
|
11 * Frank Benoit <benoit@tionex.de>
|
|
12 *******************************************************************************/
|
|
13
|
|
14 module dwtx.jface.text.rules.IPredicateRule;
|
|
15
|
|
16 import dwt.dwthelper.utils;
|
|
17
|
|
18 /**
|
|
19 * Defines the interface for a rule used in the scanning of text for the purpose of
|
|
20 * document partitioning or text styling. A predicate rule can only return one single
|
|
21 * token after having successfully detected content. This token is called success token.
|
|
22 * Also, it also returns a token indicating that this rule has not been successful.
|
|
23 *
|
|
24 * @see ICharacterScanner
|
|
25 * @since 2.0
|
|
26 */
|
|
27 public interface IPredicateRule : IRule {
|
|
28
|
|
29 /**
|
|
30 * Returns the success token of this predicate rule.
|
|
31 *
|
|
32 * @return the success token of this rule
|
|
33 */
|
|
34 IToken getSuccessToken();
|
|
35
|
|
36 /**
|
|
37 * Evaluates the rule by examining the characters available from
|
|
38 * the provided character scanner. The token returned by this rule
|
|
39 * returns <code>true</code> when calling <code>isUndefined</code>,
|
|
40 * if the text that the rule investigated does not match the rule's requirements. Otherwise,
|
|
41 * this method returns this rule's success token. If this rules relies on a text pattern
|
|
42 * comprising a opening and a closing character sequence this method can also be called
|
|
43 * when the scanner is positioned already between the opening and the closing sequence.
|
|
44 * In this case, <code>resume</code> must be set to <code>true</code>.
|
|
45 *
|
|
46 * @param scanner the character scanner to be used by this rule
|
|
47 * @param resume indicates that the rule starts working between the opening and the closing character sequence
|
|
48 * @return the token computed by the rule
|
|
49 */
|
|
50 IToken evaluate(ICharacterScanner scanner, bool resume);
|
|
51 }
|