Package org.eclipse.jface.text.rules
Interface IPredicateRule
- All Superinterfaces:
IRule
- All Known Implementing Classes:
EndOfLineRule,MultiLineRule,PatternRule,SingleLineRule,WordPatternRule
Defines the interface for a rule used in the scanning of text for the purpose of
document partitioning or text styling. A predicate rule can only return one single
token after having successfully detected content. This token is called success token.
Also, it also returns a token indicating that this rule has not been successful.
Originally since 2.0, but moved to org.eclipse.text in 3.14
- Since:
- 3.14
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionevaluate(ICharacterScanner scanner, boolean resume) Evaluates the rule by examining the characters available from the provided character scanner.Returns the success token of this predicate rule.
-
Method Details
-
getSuccessToken
IToken getSuccessToken()Returns the success token of this predicate rule.- Returns:
- the success token of this rule
-
evaluate
Evaluates the rule by examining the characters available from the provided character scanner. The token returned by this rule returnstruewhen callingisUndefined, if the text that the rule investigated does not match the rule's requirements. Otherwise, this method returns this rule's success token. If this rules relies on a text pattern comprising a opening and a closing character sequence this method can also be called when the scanner is positioned already between the opening and the closing sequence. In this case,resumemust be set totrue.- Parameters:
scanner- the character scanner to be used by this ruleresume- indicates that the rule starts working between the opening and the closing character sequence- Returns:
- the token computed by the rule
-