pmp
Class FailingMatcher

java.lang.Object
  extended by pmp.FailingMatcher
All Implemented Interfaces:
MatcherIface

public final class FailingMatcher
extends java.lang.Object
implements MatcherIface

Represents never-matching regular expression matcher.

Title: PMP: Macroprocessor

Description: Java macroprocessor

Copyright: Copyright (c) 2005

Version:
1.0
Author:
Luděk Hlaváček

Nested Class Summary
 
Nested classes/interfaces inherited from interface pmp.MatcherIface
MatcherIface.State
 
Field Summary
static java.lang.String FAILING_PATTERN
          Extension to Java regular expressions.
 
Constructor Summary
FailingMatcher(Token token)
          Creates new instance.
 
Method Summary
 void feed(int c)
          Appends character to matched string snd updates stato of this matcher.
 int getMatchingLength()
          Returns length of input subsequence that matches pattern.
 java.lang.String getPattern()
          Returns pattern associated with this matcher.
 MatcherIface.State getState()
          Returns state of matcher.
 Token getToken()
          Returns token that would be produced by this class.
 MatcherIface.State matches(java.lang.StringBuilder text)
          Resets this matcher with given string.
 void reset()
          Resets matcher.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FAILING_PATTERN

public static final java.lang.String FAILING_PATTERN
Extension to Java regular expressions. This is invalid Java pattern [] which PMP uses it to construct never-matching matcher.

See Also:
Constant Field Values
Constructor Detail

FailingMatcher

public FailingMatcher(Token token)
Creates new instance.

Parameters:
token -
Method Detail

feed

public void feed(int c)
Description copied from interface: MatcherIface
Appends character to matched string snd updates stato of this matcher.

Specified by:
feed in interface MatcherIface
Parameters:
c - chracter to be appended

getState

public MatcherIface.State getState()
Description copied from interface: MatcherIface
Returns state of matcher.

Specified by:
getState in interface MatcherIface
Returns:
result of matching procedure

matches

public MatcherIface.State matches(java.lang.StringBuilder text)
Description copied from interface: MatcherIface
Resets this matcher with given string.

Specified by:
matches in interface MatcherIface
Returns:
new state of matcher

getPattern

public java.lang.String getPattern()
Description copied from interface: MatcherIface
Returns pattern associated with this matcher.

Specified by:
getPattern in interface MatcherIface
Returns:
regular expression

getToken

public Token getToken()
Description copied from interface: MatcherIface
Returns token that would be produced by this class.

Specified by:
getToken in interface MatcherIface
Returns:
token object

getMatchingLength

public int getMatchingLength()
Description copied from interface: MatcherIface
Returns length of input subsequence that matches pattern. Valid only for states MatcherIface.State.PARTIAL and MatcherIface.State.OVERFEED.

Specified by:
getMatchingLength in interface MatcherIface
Returns:
number of characters matching the pattern

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

reset

public void reset()
Description copied from interface: MatcherIface
Resets matcher.

Specified by:
reset in interface MatcherIface