Mercurial > projects > dwt-addons
diff dwtx/jface/text/rules/EndOfLineRule.d @ 129:eb30df5ca28b
Added JFace Text sources
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 23 Aug 2008 19:10:48 +0200 |
parents | |
children | c4fb132a086c |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwtx/jface/text/rules/EndOfLineRule.d Sat Aug 23 19:10:48 2008 +0200 @@ -0,0 +1,71 @@ +/******************************************************************************* + * Copyright (c) 2000, 2005 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Christopher Lenz (cmlenz@gmx.de) - support for line continuation + * Port to the D programming language: + * Frank Benoit <benoit@tionex.de> + *******************************************************************************/ +module dwtx.jface.text.rules.EndOfLineRule; + +import dwt.dwthelper.utils; + + +/** + * A specific configuration of a single line rule + * whereby the pattern begins with a specific sequence but + * is only ended by a line delimiter. + */ +public class EndOfLineRule : SingleLineRule { + + /** + * Creates a rule for the given starting sequence + * which, if detected, will return the specified token. + * + * @param startSequence the pattern's start sequence + * @param token the token to be returned on success + */ + public EndOfLineRule(String startSequence, IToken token) { + this(startSequence, token, (char) 0); + } + + /** + * Creates a rule for the given starting sequence + * which, if detected, will return the specified token. + * Any character which follows the given escape character + * will be ignored. + * + * @param startSequence the pattern's start sequence + * @param token the token to be returned on success + * @param escapeCharacter the escape character + */ + public EndOfLineRule(String startSequence, IToken token, char escapeCharacter) { + super(startSequence, null, token, escapeCharacter, true); + } + + /** + * Creates a rule for the given starting sequence + * which, if detected, will return the specified token. + * Any character which follows the given escape character + * will be ignored. In addition, an escape character + * immediately before an end of line can be set to continue + * the line. + * + * @param startSequence the pattern's start sequence + * @param token the token to be returned on success + * @param escapeCharacter the escape character + * @param escapeContinuesLine indicates whether the specified escape + * character is used for line continuation, so that an end of + * line immediately after the escape character does not + * terminate the line, even if <code>breakOnEOL</code> is true + * @since 3.0 + */ + public EndOfLineRule(String startSequence, IToken token, char escapeCharacter, bool escapeContinuesLine) { + super(startSequence, null, token, escapeCharacter, true, escapeContinuesLine); + } +}