Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.jface.text.rules
Class WordPatternRule

    java.lang.Object
      org.eclipse.jface.text.rules.PatternRule
          org.eclipse.jface.text.rules.SingleLineRule
              org.eclipse.jface.text.rules.WordPatternRule

All Implemented Interfaces:
  IPredicateRule, IRule

public class WordPatternRule
extends SingleLineRule

A specific single line rule which stipulates that the start and end sequence occur within a single word, as defined by a word detector.

See Also:
  `IWordDetector`

Field Summary
`protected IWordDetector` | `fDetector` The word detector used by this rule

Fields inherited from class org.eclipse.jface.text.rules.PatternRule
`fBreaksOnEOF, fBreaksOnEOL, fColumn, fEndSequence, fEscapeCharacter, fEscapeContinuesLine, fStartSequence, fToken, UNDEFINED`

Constructor Summary
`WordPatternRule(IWordDetector detector, String startSequence, String endSequence, IToken token)` Creates a rule for the given starting and ending word pattern which, if detected, will return the specified token.
`WordPatternRule(IWordDetector detector, String startSequence, String endSequence, IToken token, char escapeCharacter)` /** Creates a rule for the given starting and ending word pattern which, if detected, will return the specified token.

Method Summary
`protected boolean` | `endSequenceDetected(ICharacterScanner scanner)` Returns whether the end sequence was detected.
`protected void` | `unreadBuffer(ICharacterScanner scanner)` Returns the characters in the buffer to the scanner.

Methods inherited from class org.eclipse.jface.text.rules.PatternRule
`doEvaluate, doEvaluate, evaluate, evaluate, getSuccessToken, sequenceDetected, setColumnConstraint`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### fDetector

    protected IWordDetector fDetector

  The word detector used by this rule

Constructor Detail

### WordPatternRule

    public WordPatternRule(IWordDetector detector,
                           String startSequence,
                           String endSequence,
                           IToken token)

  Creates a rule for the given starting and ending word pattern which, if detected, will return the specified token. A word detector is used to identify words.

Parameters:
  `detector` - the word detector to be used
  `startSequence` - the start sequence of the word pattern
  `endSequence` - the end sequence of the word pattern
  `token` - the token to be returned on success

### WordPatternRule

    public WordPatternRule(IWordDetector detector,
                           String startSequence,
                           String endSequence,
                           IToken token,
                           char escapeCharacter)

  /** Creates a rule for the given starting and ending word pattern which, if detected, will return the specified token. A word detector is used to identify words. Any character which follows the given escapeCharacter will be ignored.

Parameters:
  `detector` - the word detector to be used
  `startSequence` - the start sequence of the word pattern
  `endSequence` - the end sequence of the word pattern
  `token` - the token to be returned on success
  `escapeCharacter` - the escape character

Method Detail

### endSequenceDetected

    protected boolean endSequenceDetected(ICharacterScanner scanner)

  Returns whether the end sequence was detected. The rule acquires the rest of the word, using the provided word detector, and tests to determine if it ends with the end sequence.

  Overrides:
    `endSequenceDetected` in class `PatternRule`
  Parameters:
    `scanner` - the scanner to be used
  Returns:
    `true` if the word ends on the given end sequence

### unreadBuffer

    protected void unreadBuffer(ICharacterScanner scanner)

  Returns the characters in the buffer to the scanner. Note that the rule must also return the characters read in as part of the start sequence expect the first one.

  Parameters:
    `scanner` - the scanner to be used

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.