public class WhitespaceRule extends Object implements IRule
IRule
capable of detecting whitespace.
A whitespace rule uses a whitespace detector in order to find out which
characters are whitespace characters.IWhitespaceDetector
Modifier and Type | Field and Description |
---|---|
protected IWhitespaceDetector |
fDetector
The whitespace detector used by this rule
|
protected IToken |
fWhitespaceToken
The token returned for whitespace.
|
Constructor and Description |
---|
WhitespaceRule(IWhitespaceDetector detector)
Creates a rule which, with the help of an whitespace detector, will return
Token.WHITESPACE when a whitespace is detected. |
WhitespaceRule(IWhitespaceDetector detector,
IToken token)
Creates a rule which, with the help of an whitespace detector, will return the given
whitespace token when a whitespace is detected.
|
Modifier and Type | Method and Description |
---|---|
IToken |
evaluate(ICharacterScanner scanner)
Evaluates the rule by examining the characters available from the provided character scanner.
|
protected IWhitespaceDetector fDetector
protected final IToken fWhitespaceToken
public WhitespaceRule(IWhitespaceDetector detector)
Token.WHITESPACE
when a whitespace is detected.detector
- the rule's whitespace detectorpublic WhitespaceRule(IWhitespaceDetector detector, IToken token)
detector
- the rule's whitespace detectortoken
- the token returned for whitespacepublic IToken evaluate(ICharacterScanner scanner)
true
when calling
isUndefined
, if the text that the rule investigated does not match the rule's
requirementsevaluate
in interface IRule
scanner
- the character scanner to be used by this rulefWhitespaceToken
if whitespace got detected, Token.UNDEFINED
otherwise
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.