|
|||||||||
| Home >> All >> org >> eclipse >> jface >> text >> [ rules overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.eclipse.jface.text.rules
Class WordRule

java.lang.Objectorg.eclipse.jface.text.rules.WordRule
- All Implemented Interfaces:
- IRule
- public class WordRule
- extends java.lang.Object
- implements IRule
- extends java.lang.Object
An implementation of IRule capable of detecting words
Word rules also allow for the association of tokens with specific words.
That is, not only can the rule be used to provide tokens for exact matches,
but also for the generalized notion of a word in the context in which it is used.
A word rules uses a word detector to determine what a word is.
| Field Summary | |
private java.lang.StringBuffer |
fBuffer
Buffer used for pattern detection |
protected int |
fColumn
The column constraint |
protected IToken |
fDefaultToken
The default token to be returned on success and if nothing else has been specified. |
protected IWordDetector |
fDetector
The word detector used by this rule |
protected java.util.Map |
fWords
The table of predefined words and token for this rule |
protected static int |
UNDEFINED
Internal setting for the uninitialized column constraint |
| Constructor Summary | |
WordRule(IWordDetector detector)
Creates a rule which, with the help of an word detector, will return the token associated with the detected word. |
|
WordRule(IWordDetector detector,
IToken defaultToken)
Creates a rule which, with the help of an word detector, will return the token associated with the detected word. |
|
| Method Summary | |
void |
addWord(java.lang.String word,
IToken token)
Adds a word and the token to be returned if it is detected. |
IToken |
evaluate(ICharacterScanner scanner)
Evaluates the rule by examining the characters available from the provided character scanner. |
void |
setColumnConstraint(int column)
Sets a column constraint for this rule. |
protected void |
unreadBuffer(ICharacterScanner scanner)
Returns the characters in the buffer to the scanner. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
UNDEFINED
protected static final int UNDEFINED
- Internal setting for the uninitialized column constraint
- See Also:
- Constant Field Values
fDetector
protected IWordDetector fDetector
- The word detector used by this rule
fDefaultToken
protected IToken fDefaultToken
- The default token to be returned on success and if nothing else has been specified.
fColumn
protected int fColumn
- The column constraint
fWords
protected java.util.Map fWords
- The table of predefined words and token for this rule
fBuffer
private java.lang.StringBuffer fBuffer
- Buffer used for pattern detection
| Constructor Detail |
WordRule
public WordRule(IWordDetector detector)
- Creates a rule which, with the help of an word detector, will return the token
associated with the detected word. If no token has been associated, the scanner
will be rolled back and an undefined token will be returned in order to allow
any subsequent rules to analyze the characters.
WordRule
public WordRule(IWordDetector detector, IToken defaultToken)
- Creates a rule which, with the help of an word detector, will return the token
associated with the detected word. If no token has been associated, the
specified default token will be returned.
| Method Detail |
addWord
public void addWord(java.lang.String word, IToken token)
- Adds a word and the token to be returned if it is detected.
setColumnConstraint
public void setColumnConstraint(int column)
- Sets a column constraint for this rule. If set, the rule's token
will only be returned if the pattern is detected starting at the
specified column. If the column is smaller then 0, the column
constraint is considered removed.
evaluate
public IToken evaluate(ICharacterScanner scanner)
- Description copied from interface:
IRule - Evaluates the rule by examining the characters available from
the provided character scanner. The token returned by this rule
returns
truewhen callingisUndefined, if the text the rule investigated does not match the rule's requirements.
unreadBuffer
protected void unreadBuffer(ICharacterScanner scanner)
- Returns the characters in the buffer to the scanner.
|
|||||||||
| Home >> All >> org >> eclipse >> jface >> text >> [ rules overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.eclipse.jface.text.rules.WordRule