129
|
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 * Port to the D programming language:
|
|
11 * Frank Benoit <benoit@tionex.de>
|
|
12 *******************************************************************************/
|
|
13 module dwtx.jface.text.rules.MultiLineRule;
|
|
14
|
131
|
15 import dwtx.jface.text.rules.FastPartitioner; // packageimport
|
|
16 import dwtx.jface.text.rules.ITokenScanner; // packageimport
|
|
17 import dwtx.jface.text.rules.Token; // packageimport
|
|
18 import dwtx.jface.text.rules.RuleBasedScanner; // packageimport
|
|
19 import dwtx.jface.text.rules.EndOfLineRule; // packageimport
|
|
20 import dwtx.jface.text.rules.WordRule; // packageimport
|
|
21 import dwtx.jface.text.rules.WhitespaceRule; // packageimport
|
|
22 import dwtx.jface.text.rules.WordPatternRule; // packageimport
|
|
23 import dwtx.jface.text.rules.IPredicateRule; // packageimport
|
|
24 import dwtx.jface.text.rules.DefaultPartitioner; // packageimport
|
|
25 import dwtx.jface.text.rules.NumberRule; // packageimport
|
|
26 import dwtx.jface.text.rules.SingleLineRule; // packageimport
|
|
27 import dwtx.jface.text.rules.PatternRule; // packageimport
|
|
28 import dwtx.jface.text.rules.IWordDetector; // packageimport
|
|
29 import dwtx.jface.text.rules.RuleBasedDamagerRepairer; // packageimport
|
|
30 import dwtx.jface.text.rules.ICharacterScanner; // packageimport
|
|
31 import dwtx.jface.text.rules.IRule; // packageimport
|
|
32 import dwtx.jface.text.rules.DefaultDamagerRepairer; // packageimport
|
|
33 import dwtx.jface.text.rules.IToken; // packageimport
|
|
34 import dwtx.jface.text.rules.IPartitionTokenScanner; // packageimport
|
|
35 import dwtx.jface.text.rules.RuleBasedPartitioner; // packageimport
|
|
36 import dwtx.jface.text.rules.RuleBasedPartitionScanner; // packageimport
|
|
37 import dwtx.jface.text.rules.BufferedRuleBasedScanner; // packageimport
|
|
38 import dwtx.jface.text.rules.IWhitespaceDetector; // packageimport
|
|
39
|
|
40
|
129
|
41 import dwt.dwthelper.utils;
|
|
42
|
|
43
|
|
44 /**
|
|
45 * A rule for detecting patterns which begin with a given
|
|
46 * sequence and may end with a given sequence thereby spanning
|
|
47 * multiple lines.
|
|
48 */
|
|
49 public class MultiLineRule : PatternRule {
|
|
50
|
|
51 /**
|
|
52 * Creates a rule for the given starting and ending sequence
|
|
53 * which, if detected, will return the specified token.
|
|
54 *
|
|
55 * @param startSequence the pattern's start sequence
|
|
56 * @param endSequence the pattern's end sequence
|
|
57 * @param token the token to be returned on success
|
|
58 */
|
|
59 public MultiLineRule(String startSequence, String endSequence, IToken token) {
|
|
60 this(startSequence, endSequence, token, (char) 0);
|
|
61 }
|
|
62
|
|
63 /**
|
|
64 * Creates a rule for the given starting and ending sequence
|
|
65 * which, if detected, will return the specific token.
|
|
66 * Any character which follows the given escape character will be ignored.
|
|
67 *
|
|
68 * @param startSequence the pattern's start sequence
|
|
69 * @param endSequence the pattern's end sequence
|
|
70 * @param token the token to be returned on success
|
|
71 * @param escapeCharacter the escape character
|
|
72 */
|
|
73 public MultiLineRule(String startSequence, String endSequence, IToken token, char escapeCharacter) {
|
|
74 this(startSequence, endSequence, token, escapeCharacter, false);
|
|
75 }
|
|
76
|
|
77 /**
|
|
78 * Creates a rule for the given starting and ending sequence
|
|
79 * which, if detected, will return the specific token. Any character that follows the
|
|
80 * given escape character will be ignored. <code>breakOnEOF</code> indicates whether
|
|
81 * EOF is equivalent to detecting the <code>endSequence</code>.
|
|
82 *
|
|
83 * @param startSequence the pattern's start sequence
|
|
84 * @param endSequence the pattern's end sequence
|
|
85 * @param token the token to be returned on success
|
|
86 * @param escapeCharacter the escape character
|
|
87 * @param breaksOnEOF indicates whether the end of the file terminates this rule successfully
|
|
88 * @since 2.1
|
|
89 */
|
|
90 public MultiLineRule(String startSequence, String endSequence, IToken token, char escapeCharacter, bool breaksOnEOF) {
|
|
91 super(startSequence, endSequence, token, escapeCharacter, false, breaksOnEOF);
|
|
92 }
|
|
93 }
|