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
|
131
|
16 import dwtx.jface.text.rules.FastPartitioner; // packageimport
|
|
17 import dwtx.jface.text.rules.ITokenScanner; // packageimport
|
|
18 import dwtx.jface.text.rules.Token; // packageimport
|
|
19 import dwtx.jface.text.rules.RuleBasedScanner; // 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.MultiLineRule; // packageimport
|
|
36 import dwtx.jface.text.rules.RuleBasedPartitioner; // packageimport
|
|
37 import dwtx.jface.text.rules.RuleBasedPartitionScanner; // packageimport
|
|
38 import dwtx.jface.text.rules.BufferedRuleBasedScanner; // packageimport
|
|
39 import dwtx.jface.text.rules.IWhitespaceDetector; // packageimport
|
|
40
|
|
41
|
129
|
42 import dwt.dwthelper.utils;
|
|
43
|
|
44
|
|
45 /**
|
|
46 * A specific configuration of a single line rule
|
|
47 * whereby the pattern begins with a specific sequence but
|
|
48 * is only ended by a line delimiter.
|
|
49 */
|
|
50 public class EndOfLineRule : SingleLineRule {
|
|
51
|
|
52 /**
|
|
53 * Creates a rule for the given starting sequence
|
|
54 * which, if detected, will return the specified token.
|
|
55 *
|
|
56 * @param startSequence the pattern's start sequence
|
|
57 * @param token the token to be returned on success
|
|
58 */
|
|
59 public EndOfLineRule(String startSequence, IToken token) {
|
|
60 this(startSequence, token, (char) 0);
|
|
61 }
|
|
62
|
|
63 /**
|
|
64 * Creates a rule for the given starting sequence
|
|
65 * which, if detected, will return the specified token.
|
|
66 * Any character which follows the given escape character
|
|
67 * will be ignored.
|
|
68 *
|
|
69 * @param startSequence the pattern's start sequence
|
|
70 * @param token the token to be returned on success
|
|
71 * @param escapeCharacter the escape character
|
|
72 */
|
|
73 public EndOfLineRule(String startSequence, IToken token, char escapeCharacter) {
|
|
74 super(startSequence, null, token, escapeCharacter, true);
|
|
75 }
|
|
76
|
|
77 /**
|
|
78 * Creates a rule for the given starting sequence
|
|
79 * which, if detected, will return the specified token.
|
|
80 * Any character which follows the given escape character
|
|
81 * will be ignored. In addition, an escape character
|
|
82 * immediately before an end of line can be set to continue
|
|
83 * the line.
|
|
84 *
|
|
85 * @param startSequence the pattern's start sequence
|
|
86 * @param token the token to be returned on success
|
|
87 * @param escapeCharacter the escape character
|
|
88 * @param escapeContinuesLine indicates whether the specified escape
|
|
89 * character is used for line continuation, so that an end of
|
|
90 * line immediately after the escape character does not
|
|
91 * terminate the line, even if <code>breakOnEOL</code> is true
|
|
92 * @since 3.0
|
|
93 */
|
|
94 public EndOfLineRule(String startSequence, IToken token, char escapeCharacter, bool escapeContinuesLine) {
|
|
95 super(startSequence, null, token, escapeCharacter, true, escapeContinuesLine);
|
|
96 }
|
|
97 }
|