pmp
Class JavaMatcher

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

public class JavaMatcher
extends java.lang.Object
implements MatcherIface

Represents regular expression analyzer.

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 int MAX_TOKEN_LENGTH
          maximal length of buffer.
 
Constructor Summary
JavaMatcher(Token token, java.util.regex.Pattern pattern)
           
 
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 t)
          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

MAX_TOKEN_LENGTH

public static final int MAX_TOKEN_LENGTH
maximal length of buffer.

See Also:
Constant Field Values
To Do:
this should be removed (how?)
Constructor Detail

JavaMatcher

public JavaMatcher(Token token,
                   java.util.regex.Pattern pattern)
Method Detail

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

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

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

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

matches

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

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