|
What this is
Other links
The source code/******************************************************************************* * 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 *******************************************************************************/ package org.eclipse.jdt.internal.ui.propertiesfileeditor; import org.eclipse.jface.text.rules.ICharacterScanner; import org.eclipse.jface.text.rules.IToken; import org.eclipse.jface.text.rules.IWordDetector; import org.eclipse.jface.text.rules.WordPatternRule; /** * A leading white space predicate rule. * * @since 3.1 */ public final class LeadingWhitespacePredicateRule extends WordPatternRule { private static class DummyDetector implements IWordDetector { /* * @see IWordDetector#isWordStart */ public boolean isWordStart(char c) { return false; } /* * @see IWordDetector#isWordPart */ public boolean isWordPart(char c) { return false; } } /** * Creates a white space rule for the given <code>token. * * @param token the token to be returned on success */ public LeadingWhitespacePredicateRule(IToken token, String whitespace) { super(new DummyDetector(), whitespace, "dummy", token); //$NON-NLS-1$ setColumnConstraint(0); } /* * @see org.eclipse.jface.text.rules.WordPatternRule#endSequenceDetected(org.eclipse.jface.text.rules.ICharacterScanner) */ protected boolean endSequenceDetected(ICharacterScanner scanner) { int c; do { c= scanner.read(); } while (Character.isWhitespace((char) c)); scanner.unread(); return true; } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.