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 * Christopher Lenz (cmlenz@gmx.de) - support for line continuation
|
|
11 * Port to the D programming language:
|
|
12 * Frank Benoit <benoit@tionex.de>
|
|
13 *******************************************************************************/
|
|
14 module dwtx.jface.text.rules.EndOfLineRule;
|
|
15
|
|
16 import dwt.dwthelper.utils;
|
|
17
|
|
18
|
|
19 /**
|
|
20 * A specific configuration of a single line rule
|
|
21 * whereby the pattern begins with a specific sequence but
|
|
22 * is only ended by a line delimiter.
|
|
23 */
|
|
24 public class EndOfLineRule : SingleLineRule {
|
|
25
|
|
26 /**
|
|
27 * Creates a rule for the given starting sequence
|
|
28 * which, if detected, will return the specified token.
|
|
29 *
|
|
30 * @param startSequence the pattern's start sequence
|
|
31 * @param token the token to be returned on success
|
|
32 */
|
|
33 public EndOfLineRule(String startSequence, IToken token) {
|
|
34 this(startSequence, token, (char) 0);
|
|
35 }
|
|
36
|
|
37 /**
|
|
38 * Creates a rule for the given starting sequence
|
|
39 * which, if detected, will return the specified token.
|
|
40 * Any character which follows the given escape character
|
|
41 * will be ignored.
|
|
42 *
|
|
43 * @param startSequence the pattern's start sequence
|
|
44 * @param token the token to be returned on success
|
|
45 * @param escapeCharacter the escape character
|
|
46 */
|
|
47 public EndOfLineRule(String startSequence, IToken token, char escapeCharacter) {
|
|
48 super(startSequence, null, token, escapeCharacter, true);
|
|
49 }
|
|
50
|
|
51 /**
|
|
52 * Creates a rule for the given starting sequence
|
|
53 * which, if detected, will return the specified token.
|
|
54 * Any character which follows the given escape character
|
|
55 * will be ignored. In addition, an escape character
|
|
56 * immediately before an end of line can be set to continue
|
|
57 * the line.
|
|
58 *
|
|
59 * @param startSequence the pattern's start sequence
|
|
60 * @param token the token to be returned on success
|
|
61 * @param escapeCharacter the escape character
|
|
62 * @param escapeContinuesLine indicates whether the specified escape
|
|
63 * character is used for line continuation, so that an end of
|
|
64 * line immediately after the escape character does not
|
|
65 * terminate the line, even if <code>breakOnEOL</code> is true
|
|
66 * @since 3.0
|
|
67 */
|
|
68 public EndOfLineRule(String startSequence, IToken token, char escapeCharacter, bool escapeContinuesLine) {
|
|
69 super(startSequence, null, token, escapeCharacter, true, escapeContinuesLine);
|
|
70 }
|
|
71 }
|