org.eclipse.cdt.internal.ui.text
Class PreprocessorRule
java.lang.Object
org.eclipse.jface.text.rules.WordRule
org.eclipse.cdt.internal.ui.text.PreprocessorRule
- All Implemented Interfaces:
- org.eclipse.jface.text.rules.IRule
public class PreprocessorRule
- extends org.eclipse.jface.text.rules.WordRule
Implementation of IRule
for C/C++ preprocessor scanning.
It is capable of detecting a pattern which begins with 0 or more whitespaces
at the beginning of the string, then '#' sign, then 0 or more whitespaces
again, and then directive itself.
Constructor Summary |
PreprocessorRule(org.eclipse.jface.text.rules.IWordDetector detector)
Creates a rule which, with the help of a word detector, will return the token
associated with the detected word. |
PreprocessorRule(org.eclipse.jface.text.rules.IWordDetector detector,
org.eclipse.jface.text.rules.IToken defaultToken)
Creates a rule which, with the help of an word detector, will return the token
associated with the detected word. |
PreprocessorRule(org.eclipse.jface.text.rules.IWordDetector detector,
org.eclipse.jface.text.rules.IToken defaultToken,
org.eclipse.jface.text.rules.IToken malformedToken)
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,
org.eclipse.jface.text.rules.IToken token)
|
org.eclipse.jface.text.rules.IToken |
evaluate(org.eclipse.jface.text.rules.ICharacterScanner scanner)
|
Methods inherited from class org.eclipse.jface.text.rules.WordRule |
setColumnConstraint |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PreprocessorRule
public PreprocessorRule(org.eclipse.jface.text.rules.IWordDetector detector)
- 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 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:
WordRule.addWord(java.lang.String, org.eclipse.jface.text.rules.IToken)
PreprocessorRule
public PreprocessorRule(org.eclipse.jface.text.rules.IWordDetector detector,
org.eclipse.jface.text.rules.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.
- 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:
WordRule.addWord(java.lang.String, org.eclipse.jface.text.rules.IToken)
PreprocessorRule
public PreprocessorRule(org.eclipse.jface.text.rules.IWordDetector detector,
org.eclipse.jface.text.rules.IToken defaultToken,
org.eclipse.jface.text.rules.IToken malformedToken)
- 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.
- 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
malformedToken
- the token to be returned if the directive is malformed- See Also:
WordRule.addWord(java.lang.String, org.eclipse.jface.text.rules.IToken)
addWord
public void addWord(java.lang.String word,
org.eclipse.jface.text.rules.IToken token)
- Overrides:
addWord
in class org.eclipse.jface.text.rules.WordRule
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
- Overrides:
evaluate
in class org.eclipse.jface.text.rules.WordRule