KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > text > rules > SingleLineRule


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  *******************************************************************************/

12 package org.eclipse.jface.text.rules;
13
14
15 /**
16  * A specific configuration of pattern rule whereby
17  * the pattern begins with a specific sequence and may
18  * end with a specific sequence, but will not span more
19  * than a single line.
20  */

21 public class SingleLineRule extends PatternRule {
22
23     /**
24      * Creates a rule for the given starting and ending sequence
25      * which, if detected, will return the specified token.
26      *
27      * @param startSequence the pattern's start sequence
28      * @param endSequence the pattern's end sequence
29      * @param token the token to be returned on success
30      */

31     public SingleLineRule(String JavaDoc startSequence, String JavaDoc endSequence, IToken token) {
32         this(startSequence, endSequence, token, (char) 0);
33     }
34
35     /**
36      * Creates a rule for the given starting and ending sequence
37      * which, if detected, will return the specified token.
38      * Any character which follows the given escape character
39      * will be ignored.
40      *
41      * @param startSequence the pattern's start sequence
42      * @param endSequence the pattern's end sequence
43      * @param token the token to be returned on success
44      * @param escapeCharacter the escape character
45      */

46     public SingleLineRule(String JavaDoc startSequence, String JavaDoc endSequence, IToken token, char escapeCharacter) {
47         this(startSequence, endSequence, token, escapeCharacter, false);
48     }
49
50     /**
51      * Creates a rule for the given starting and ending sequence
52      * which, if detected, will return the specified token. Alternatively, the
53      * line can also be ended with the end of the file.
54      * Any character which follows the given escape character
55      * will be ignored.
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 successfully terminates this rule
62      * @since 2.1
63      */

64     public SingleLineRule(String JavaDoc startSequence, String JavaDoc endSequence, IToken token, char escapeCharacter, boolean breaksOnEOF) {
65         super(startSequence, endSequence, token, escapeCharacter, true, breaksOnEOF);
66     }
67
68     /**
69      * Creates a rule for the given starting and ending sequence
70      * which, if detected, will return the specified token. Alternatively, the
71      * line can also be ended with the end of the file.
72      * Any character which follows the given escape character
73      * will be ignored. In addition, an escape character immediately before an
74      * end of line can be set to continue the line.
75      *
76      * @param startSequence the pattern's start sequence
77      * @param endSequence the pattern's end sequence
78      * @param token the token to be returned on success
79      * @param escapeCharacter the escape character
80      * @param breaksOnEOF indicates whether the end of the file successfully terminates this rule
81      * @param escapeContinuesLine indicates whether the specified escape character is used for line
82      * continuation, so that an end of line immediately after the escape character does not
83      * terminate the line, even if <code>breakOnEOL</code> is true
84      * @since 3.0
85      */

86     public SingleLineRule(String JavaDoc startSequence, String JavaDoc endSequence, IToken token, char escapeCharacter, boolean breaksOnEOF, boolean escapeContinuesLine) {
87         super(startSequence, endSequence, token, escapeCharacter, true, breaksOnEOF, escapeContinuesLine);
88     }
89 }
90
Popular Tags