|
org.eclipse.jface.text.rules
Class WordPatternRule
java.lang.Object
org.eclipse.jface.text.rules.PatternRule
org.eclipse.jface.text.rules.SingleLineRule
org.eclipse.jface.text.rules.WordPatternRule
-
All Implemented Interfaces:
-
IPredicateRule,
IRule
-
public class WordPatternRule
- extends
SingleLineRule
A specific single line rule which stipulates that the start
and end sequence occur within a single word, as defined by a word detector.
-
See Also:
-
IWordDetector
Constructor Summary
|
WordPatternRule
(
IWordDetector detector,
String startSequence,
String endSequence,
IToken token)
Creates a rule for the given starting and ending word
pattern which, if detected, will return the specified token. |
WordPatternRule
(
IWordDetector detector,
String startSequence,
String endSequence,
IToken token,
char escapeCharacter)
/**
Creates a rule for the given starting and ending word
pattern which, if detected, will return the specified token. |
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
fDetector
protected
IWordDetector fDetector
- The word detector used by this rule
WordPatternRule
public WordPatternRule(
IWordDetector detector,
String startSequence,
String endSequence,
IToken token)
- Creates a rule for the given starting and ending word
pattern which, if detected, will return the specified token.
A word detector is used to identify words.
-
Parameters:
-
detector - the word detector to be used -
startSequence - the start sequence of the word pattern -
endSequence - the end sequence of the word pattern -
token - the token to be returned on success
WordPatternRule
public WordPatternRule(
IWordDetector detector,
String startSequence,
String endSequence,
IToken token,
char escapeCharacter)
- /**
Creates a rule for the given starting and ending word
pattern which, if detected, will return the specified token.
A word detector is used to identify words.
Any character which follows the given escapeCharacter will be ignored.
-
Parameters:
-
detector - the word detector to be used -
startSequence - the start sequence of the word pattern -
endSequence - the end sequence of the word pattern -
token - the token to be returned on success -
escapeCharacter - the escape character
endSequenceDetected
protected boolean endSequenceDetected(
ICharacterScanner scanner)
- Returns whether the end sequence was detected.
The rule acquires the rest of the word, using the
provided word detector, and tests to determine if
it ends with the end sequence.
-
-
Overrides:
-
endSequenceDetected
in class
PatternRule
-
-
Parameters:
-
scanner - the scanner to be used
-
Returns:
-
true if the word ends on the given end sequence
unreadBuffer
protected void unreadBuffer(
ICharacterScanner scanner)
- Returns the characters in the buffer to the scanner.
Note that the rule must also return the characters
read in as part of the start sequence expect the first one.
-
-
Parameters:
-
scanner - the scanner to be used
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.
|
|