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
|
|
15 import dwt.dwthelper.utils;
|
|
16
|
|
17
|
|
18 /**
|
|
19 * A rule for detecting patterns which begin with a given
|
|
20 * sequence and may end with a given sequence thereby spanning
|
|
21 * multiple lines.
|
|
22 */
|
|
23 public class MultiLineRule : PatternRule {
|
|
24
|
|
25 /**
|
|
26 * Creates a rule for the given starting and ending sequence
|
|
27 * which, if detected, will return the specified token.
|
|
28 *
|
|
29 * @param startSequence the pattern's start sequence
|
|
30 * @param endSequence the pattern's end sequence
|
|
31 * @param token the token to be returned on success
|
|
32 */
|
|
33 public MultiLineRule(String startSequence, String endSequence, IToken token) {
|
|
34 this(startSequence, endSequence, token, (char) 0);
|
|
35 }
|
|
36
|
|
37 /**
|
|
38 * Creates a rule for the given starting and ending sequence
|
|
39 * which, if detected, will return the specific token.
|
|
40 * Any character which follows the given escape character will be ignored.
|
|
41 *
|
|
42 * @param startSequence the pattern's start sequence
|
|
43 * @param endSequence the pattern's end sequence
|
|
44 * @param token the token to be returned on success
|
|
45 * @param escapeCharacter the escape character
|
|
46 */
|
|
47 public MultiLineRule(String startSequence, String endSequence, IToken token, char escapeCharacter) {
|
|
48 this(startSequence, endSequence, token, escapeCharacter, false);
|
|
49 }
|
|
50
|
|
51 /**
|
|
52 * Creates a rule for the given starting and ending sequence
|
|
53 * which, if detected, will return the specific token. Any character that follows the
|
|
54 * given escape character will be ignored. <code>breakOnEOF</code> indicates whether
|
|
55 * EOF is equivalent to detecting the <code>endSequence</code>.
|
|
56 *
|
|
57 * @param startSequence the pattern's start sequence
|
|
58 * @param endSequence the pattern's end sequence
|
|
59 * @param token the token to be returned on success
|
|
60 * @param escapeCharacter the escape character
|
|
61 * @param breaksOnEOF indicates whether the end of the file terminates this rule successfully
|
|
62 * @since 2.1
|
|
63 */
|
|
64 public MultiLineRule(String startSequence, String endSequence, IToken token, char escapeCharacter, bool breaksOnEOF) {
|
|
65 super(startSequence, endSequence, token, escapeCharacter, false, breaksOnEOF);
|
|
66 }
|
|
67 }
|