org.eclipse.mtl.ide.ui.editors.template.rules
Class SequenceBlockRule

java.lang.Object
  extended by org.eclipse.mtl.ide.ui.editors.template.rules.SequenceBlockRule
All Implemented Interfaces:
org.eclipse.jface.text.rules.IPredicateRule, org.eclipse.jface.text.rules.IRule, ISequenceRule

public class SequenceBlockRule
extends java.lang.Object
implements ISequenceRule

Creates a rule for the given starting and ending sequence which, if detected, will return the specified token. It can also return the specified token if the rule breaks on the end of the line, or if the EOF character is read.


Field Summary
protected  ISequenceRule begin
          The pattern's start sequence.
protected  ISequenceRule end
          The pattern's end sequence.
protected  SequenceBlockRule[] ignoredBlocks
          Ignored sub-blocks.
protected  boolean isEOF
          Indicates whether end of file terminates the pattern.
protected  boolean isEOL
          Indicates whether end of line terminates the pattern.
protected  boolean recursive
          The recursive mode.
protected  ISequenceRule spec
          The pattern's escape character.
protected  org.eclipse.jface.text.rules.IToken token
          The token to be returned on success.
 
Constructor Summary
SequenceBlockRule(ISequenceRule begin, ISequenceRule end, ISequenceRule spec, org.eclipse.jface.text.rules.IToken token)
          Constructor.
SequenceBlockRule(ISequenceRule begin, ISequenceRule end, SequenceBlockRule[] ignoredBlocks, org.eclipse.jface.text.rules.IToken token)
          Constructor.
 
Method Summary
 org.eclipse.jface.text.rules.IToken evaluate(org.eclipse.jface.text.rules.ICharacterScanner scanner)
          
 org.eclipse.jface.text.rules.IToken evaluate(org.eclipse.jface.text.rules.ICharacterScanner scanner, boolean resume)
          
 org.eclipse.jface.text.rules.IToken getSuccessToken()
          
 int read(org.eclipse.jface.text.rules.ICharacterScanner scanner)
          Evaluates the rule by examining the characters available from the provided character scanner.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

begin

protected ISequenceRule begin
The pattern's start sequence.


end

protected ISequenceRule end
The pattern's end sequence.


recursive

protected boolean recursive
The recursive mode.


isEOL

protected boolean isEOL
Indicates whether end of line terminates the pattern.


isEOF

protected boolean isEOF
Indicates whether end of file terminates the pattern.


spec

protected ISequenceRule spec
The pattern's escape character.


ignoredBlocks

protected SequenceBlockRule[] ignoredBlocks
Ignored sub-blocks.


token

protected org.eclipse.jface.text.rules.IToken token
The token to be returned on success.

Constructor Detail

SequenceBlockRule

public SequenceBlockRule(ISequenceRule begin,
                         ISequenceRule end,
                         ISequenceRule spec,
                         org.eclipse.jface.text.rules.IToken token)
Constructor.

Parameters:
begin - is the pattern's start sequence
end - is the pattern's end sequence
spec - is the pattern's escape character
token - is the token to be returned on success

SequenceBlockRule

public SequenceBlockRule(ISequenceRule begin,
                         ISequenceRule end,
                         SequenceBlockRule[] ignoredBlocks,
                         org.eclipse.jface.text.rules.IToken token)
Constructor.

Parameters:
begin - is the pattern's start sequence
end - is the pattern's end sequence
ignoredBlocks - are the ignored sub-blocks
token - is the token to be returned on success
Method Detail

getSuccessToken

public org.eclipse.jface.text.rules.IToken getSuccessToken()

Specified by:
getSuccessToken in interface org.eclipse.jface.text.rules.IPredicateRule
See Also:
IPredicateRule.getSuccessToken()

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
See Also:
IRule.evaluate(org.eclipse.jface.text.rules.ICharacterScanner)

read

public int read(org.eclipse.jface.text.rules.ICharacterScanner scanner)
Evaluates the rule by examining the characters available from the provided character scanner.

Specified by:
read in interface ISequenceRule
Parameters:
scanner - is the character scanner to be used by this rule
Returns:
the number of examined characters
See Also:
ISequenceRule.read(org.eclipse.jface.text.rules.ICharacterScanner)

evaluate

public org.eclipse.jface.text.rules.IToken evaluate(org.eclipse.jface.text.rules.ICharacterScanner scanner,
                                                    boolean resume)

Specified by:
evaluate in interface org.eclipse.jface.text.rules.IPredicateRule
See Also:
IPredicateRule.evaluate(org.eclipse.jface.text.rules.ICharacterScanner, boolean)

Copyright 2008 Obeo
All Rights Reserved.