com.pvx.ooadide.codehilite2
Class PvxWordRule

java.lang.Object
  extended by com.pvx.ooadide.codehilite2.PvxWordRule
All Implemented Interfaces:
org.eclipse.jface.text.rules.IRule
Direct Known Subclasses:
ExtKeywordRule, PvxDirectiveWordRule, PvxLineLabelWordRule, PvxMnemonicRule, PvxNumbLiteralRule

public class PvxWordRule
extends java.lang.Object
implements org.eclipse.jface.text.rules.IRule


Constructor Summary
PvxWordRule(org.eclipse.jface.text.rules.IWordDetector detector)
          Creates a rule which, with the help of an word detector, will return the token associated with the detected word.
PvxWordRule(org.eclipse.jface.text.rules.IWordDetector detector, org.eclipse.jface.text.rules.IToken defaultToken)
          Creates a rule which, with the help of a word detector, will return the token associated with the detected word.
 
Method Summary
 void addWord(java.lang.String word, org.eclipse.jface.text.rules.IToken token)
          Adds a word and the token to be returned if it is detected.
 org.eclipse.jface.text.rules.IToken evaluate(org.eclipse.jface.text.rules.ICharacterScanner scanner)
           
 void setColumnConstraint(int column)
          Sets a column constraint for this rule.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PvxWordRule

public PvxWordRule(org.eclipse.jface.text.rules.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.

Parameters:
detector - the word detector to be used by this rule, may not be null
See Also:
addWord(String, IToken)

PvxWordRule

public PvxWordRule(org.eclipse.jface.text.rules.IWordDetector detector,
                   org.eclipse.jface.text.rules.IToken defaultToken)
Creates a rule which, with the help of a word detector, will return the token associated with the detected word. If no token has been associated, the specified default token will be returned.

Parameters:
detector - the word detector to be used by this rule, may not be null
defaultToken - the default token to be returned on success if nothing else is specified, may not be null
See Also:
addWord(String, IToken)
Method Detail

addWord

public void addWord(java.lang.String word,
                    org.eclipse.jface.text.rules.IToken token)
Adds a word and the token to be returned if it is detected.

Parameters:
word - the word this rule will search for, may not be null
token - the token to be returned if the word has been found, may not be null

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.

Parameters:
column - the column in which the pattern starts

evaluate

public org.eclipse.jface.text.rules.IToken evaluate(org.eclipse.jface.text.rules.ICharacterScanner scanner)
Specified by:
evaluate in interface org.eclipse.jface.text.rules.IRule