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
|
131
|
14
|
151
|
15 module dwtx.jface.text.rules.IPredicateRule;
|
|
16
|
131
|
17 import dwtx.jface.text.rules.FastPartitioner; // packageimport
|
|
18 import dwtx.jface.text.rules.ITokenScanner; // packageimport
|
|
19 import dwtx.jface.text.rules.Token; // packageimport
|
|
20 import dwtx.jface.text.rules.RuleBasedScanner; // packageimport
|
|
21 import dwtx.jface.text.rules.EndOfLineRule; // packageimport
|
|
22 import dwtx.jface.text.rules.WordRule; // packageimport
|
|
23 import dwtx.jface.text.rules.WhitespaceRule; // packageimport
|
|
24 import dwtx.jface.text.rules.WordPatternRule; // packageimport
|
|
25 import dwtx.jface.text.rules.DefaultPartitioner; // packageimport
|
|
26 import dwtx.jface.text.rules.NumberRule; // packageimport
|
|
27 import dwtx.jface.text.rules.SingleLineRule; // packageimport
|
|
28 import dwtx.jface.text.rules.PatternRule; // packageimport
|
|
29 import dwtx.jface.text.rules.IWordDetector; // packageimport
|
|
30 import dwtx.jface.text.rules.RuleBasedDamagerRepairer; // packageimport
|
|
31 import dwtx.jface.text.rules.ICharacterScanner; // packageimport
|
|
32 import dwtx.jface.text.rules.IRule; // packageimport
|
|
33 import dwtx.jface.text.rules.DefaultDamagerRepairer; // packageimport
|
|
34 import dwtx.jface.text.rules.IToken; // packageimport
|
|
35 import dwtx.jface.text.rules.IPartitionTokenScanner; // packageimport
|
|
36 import dwtx.jface.text.rules.MultiLineRule; // packageimport
|
|
37 import dwtx.jface.text.rules.RuleBasedPartitioner; // packageimport
|
|
38 import dwtx.jface.text.rules.RuleBasedPartitionScanner; // packageimport
|
|
39 import dwtx.jface.text.rules.BufferedRuleBasedScanner; // packageimport
|
|
40 import dwtx.jface.text.rules.IWhitespaceDetector; // packageimport
|
|
41
|
129
|
42 import dwt.dwthelper.utils;
|
|
43
|
|
44 /**
|
|
45 * Defines the interface for a rule used in the scanning of text for the purpose of
|
|
46 * document partitioning or text styling. A predicate rule can only return one single
|
|
47 * token after having successfully detected content. This token is called success token.
|
|
48 * Also, it also returns a token indicating that this rule has not been successful.
|
|
49 *
|
|
50 * @see ICharacterScanner
|
|
51 * @since 2.0
|
|
52 */
|
|
53 public interface IPredicateRule : IRule {
|
|
54
|
|
55 /**
|
|
56 * Returns the success token of this predicate rule.
|
|
57 *
|
|
58 * @return the success token of this rule
|
|
59 */
|
|
60 IToken getSuccessToken();
|
|
61
|
|
62 /**
|
|
63 * Evaluates the rule by examining the characters available from
|
|
64 * the provided character scanner. The token returned by this rule
|
|
65 * returns <code>true</code> when calling <code>isUndefined</code>,
|
|
66 * if the text that the rule investigated does not match the rule's requirements. Otherwise,
|
|
67 * this method returns this rule's success token. If this rules relies on a text pattern
|
|
68 * comprising a opening and a closing character sequence this method can also be called
|
|
69 * when the scanner is positioned already between the opening and the closing sequence.
|
|
70 * In this case, <code>resume</code> must be set to <code>true</code>.
|
|
71 *
|
|
72 * @param scanner the character scanner to be used by this rule
|
|
73 * @param resume indicates that the rule starts working between the opening and the closing character sequence
|
|
74 * @return the token computed by the rule
|
|
75 */
|
|
76 IToken evaluate(ICharacterScanner scanner, bool resume);
|
|
77 }
|