Mercurial > projects > dwt-addons
annotate dwtx/jface/text/rules/SingleLineRule.d @ 199:eb98a5cbfd78
Fix: potential problem with synchronized, thx torhu.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Fri, 13 Mar 2009 17:03:26 +0100 |
parents | 51e6e63f930e |
children |
rev | line source |
---|---|
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.SingleLineRule; | |
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.EndOfLineRule; // packageimport | |
21 import dwtx.jface.text.rules.WordRule; // packageimport | |
22 import dwtx.jface.text.rules.WhitespaceRule; // packageimport | |
23 import dwtx.jface.text.rules.WordPatternRule; // packageimport | |
24 import dwtx.jface.text.rules.IPredicateRule; // packageimport | |
25 import dwtx.jface.text.rules.DefaultPartitioner; // packageimport | |
26 import dwtx.jface.text.rules.NumberRule; // packageimport | |
27 import dwtx.jface.text.rules.PatternRule; // packageimport | |
28 import dwtx.jface.text.rules.RuleBasedDamagerRepairer; // packageimport | |
29 import dwtx.jface.text.rules.ICharacterScanner; // packageimport | |
30 import dwtx.jface.text.rules.IRule; // packageimport | |
31 import dwtx.jface.text.rules.DefaultDamagerRepairer; // packageimport | |
32 import dwtx.jface.text.rules.IToken; // packageimport | |
33 import dwtx.jface.text.rules.IPartitionTokenScanner; // packageimport | |
34 import dwtx.jface.text.rules.MultiLineRule; // 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 specific configuration of pattern rule whereby | |
46 * the pattern begins with a specific sequence and may | |
47 * end with a specific sequence, but will not span more | |
48 * than a single line. | |
49 */ | |
50 public class SingleLineRule : PatternRule { | |
51 | |
52 /** | |
53 * Creates a rule for the given starting and ending sequence | |
54 * which, if detected, will return the specified token. | |
55 * | |
56 * @param startSequence the pattern's start sequence | |
57 * @param endSequence the pattern's end sequence | |
58 * @param token the token to be returned on success | |
59 */ | |
133
7d818bd32d63
Fix ctors to this with gvim regexp
Frank Benoit <benoit@tionex.de>
parents:
131
diff
changeset
|
60 public this(String startSequence, String endSequence, IToken token) { |
134 | 61 this(startSequence, endSequence, token, cast(wchar) 0); |
129 | 62 } |
63 | |
64 /** | |
65 * Creates a rule for the given starting and ending sequence | |
66 * which, if detected, will return the specified token. | |
67 * Any character which follows the given escape character | |
68 * will be ignored. | |
69 * | |
70 * @param startSequence the pattern's start sequence | |
71 * @param endSequence the pattern's end sequence | |
72 * @param token the token to be returned on success | |
73 * @param escapeCharacter the escape character | |
74 */ | |
133
7d818bd32d63
Fix ctors to this with gvim regexp
Frank Benoit <benoit@tionex.de>
parents:
131
diff
changeset
|
75 public this(String startSequence, String endSequence, IToken token, char escapeCharacter) { |
129 | 76 this(startSequence, endSequence, token, escapeCharacter, false); |
77 } | |
78 | |
79 /** | |
80 * Creates a rule for the given starting and ending sequence | |
81 * which, if detected, will return the specified token. Alternatively, the | |
82 * line can also be ended with the end of the file. | |
83 * Any character which follows the given escape character | |
84 * will be ignored. | |
85 * | |
86 * @param startSequence the pattern's start sequence | |
87 * @param endSequence the pattern's end sequence | |
88 * @param token the token to be returned on success | |
89 * @param escapeCharacter the escape character | |
90 * @param breaksOnEOF indicates whether the end of the file successfully terminates this rule | |
91 * @since 2.1 | |
92 */ | |
133
7d818bd32d63
Fix ctors to this with gvim regexp
Frank Benoit <benoit@tionex.de>
parents:
131
diff
changeset
|
93 public this(String startSequence, String endSequence, IToken token, char escapeCharacter, bool breaksOnEOF) { |
129 | 94 super(startSequence, endSequence, token, escapeCharacter, true, breaksOnEOF); |
95 } | |
96 | |
97 /** | |
98 * Creates a rule for the given starting and ending sequence | |
99 * which, if detected, will return the specified token. Alternatively, the | |
100 * line can also be ended with the end of the file. | |
101 * Any character which follows the given escape character | |
102 * will be ignored. In addition, an escape character immediately before an | |
103 * end of line can be set to continue the line. | |
104 * | |
105 * @param startSequence the pattern's start sequence | |
106 * @param endSequence the pattern's end sequence | |
107 * @param token the token to be returned on success | |
108 * @param escapeCharacter the escape character | |
109 * @param breaksOnEOF indicates whether the end of the file successfully terminates this rule | |
110 * @param escapeContinuesLine indicates whether the specified escape character is used for line | |
111 * continuation, so that an end of line immediately after the escape character does not | |
112 * terminate the line, even if <code>breakOnEOL</code> is true | |
113 * @since 3.0 | |
114 */ | |
133
7d818bd32d63
Fix ctors to this with gvim regexp
Frank Benoit <benoit@tionex.de>
parents:
131
diff
changeset
|
115 public this(String startSequence, String endSequence, IToken token, char escapeCharacter, bool breaksOnEOF, bool escapeContinuesLine) { |
129 | 116 super(startSequence, endSequence, token, escapeCharacter, true, breaksOnEOF, escapeContinuesLine); |
117 } | |
118 } |