Package org.eclipse.jface.text.rules
Class RuleBasedPartitionScanner
java.lang.Object
org.eclipse.jface.text.rules.RuleBasedScanner
org.eclipse.jface.text.rules.BufferedRuleBasedScanner
org.eclipse.jface.text.rules.RuleBasedPartitionScanner
- All Implemented Interfaces:
ICharacterScanner,IPartitionTokenScanner,ITokenScanner
public class RuleBasedPartitionScanner
extends BufferedRuleBasedScanner
implements IPartitionTokenScanner
Scanner that exclusively uses predicate rules.
If a partial range is set (see setPartialRange(IDocument, int, int, String, int) with
content type that is not null then this scanner will first try the rules that match
the given content type.
- Since:
- 3.14
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringThe content type of the partition in which to resume scanning.protected intThe offset of the partition inside which to resume.Fields inherited from class org.eclipse.jface.text.rules.RuleBasedScanner
fColumn, fDefaultReturnToken, fDelimiters, fDocument, fOffset, fRangeEnd, fRules, fTokenOffset, UNDEFINEDFields inherited from interface org.eclipse.jface.text.rules.ICharacterScanner
EOF -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the next token in the document.voidsetPartialRange(IDocument document, int offset, int length, String contentType, int partitionOffset) Configures the scanner by providing access to the document range that should be scanned.voidsetPredicateRules(IPredicateRule[] rules) voidConfigures the scanner by providing access to the document range that should be scanned.voidDisallow setting the rules since this scanner exclusively uses predicate rules.Methods inherited from class org.eclipse.jface.text.rules.BufferedRuleBasedScanner
read, setBufferSize, unreadMethods inherited from class org.eclipse.jface.text.rules.RuleBasedScanner
getColumn, getLegalLineDelimiters, getTokenLength, getTokenOffset, setDefaultReturnTokenMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.jface.text.rules.ITokenScanner
getTokenLength, getTokenOffset
-
Field Details
-
fContentType
The content type of the partition in which to resume scanning. -
fPartitionOffset
protected int fPartitionOffsetThe offset of the partition inside which to resume.
-
-
Constructor Details
-
RuleBasedPartitionScanner
public RuleBasedPartitionScanner()
-
-
Method Details
-
setRules
Disallow setting the rules since this scanner exclusively uses predicate rules.- Overrides:
setRulesin classRuleBasedScanner- Parameters:
rules- the sequence of rules controlling this scanner
-
setPredicateRules
-
setRange
Description copied from interface:ITokenScannerConfigures the scanner by providing access to the document range that should be scanned.- Specified by:
setRangein interfaceITokenScanner- Overrides:
setRangein classBufferedRuleBasedScanner- Parameters:
document- the document to scanoffset- the offset of the document range to scanlength- the length of the document range to scan
-
setPartialRange
public void setPartialRange(IDocument document, int offset, int length, String contentType, int partitionOffset) Configures the scanner by providing access to the document range that should be scanned. The range may not only contain complete partitions but starts at the beginning of a line in the middle of a partition of the given content type. This requires that a partition delimiter can not contain a line delimiter.If the given content type is not
nullthen this scanner will first try the rules that match the given content type.- Specified by:
setPartialRangein interfaceIPartitionTokenScanner- Parameters:
document- the document to scanoffset- the offset of the document range to scanlength- the length of the document range to scancontentType- the content type at the given offsetpartitionOffset- the offset at which the partition of the given offset starts
-
nextToken
Description copied from interface:ITokenScannerReturns the next token in the document.- Specified by:
nextTokenin interfaceITokenScanner- Overrides:
nextTokenin classRuleBasedScanner- Returns:
- the next token in the document
-