pobs.parser
Class POnMatch

java.lang.Object
  extended bypobs.PParser
      extended bypobs.parser.POnMatch
All Implemented Interfaces:
PObject

public class POnMatch
extends PParser

Utility parser which allows actions to be performed at specific stages during the parsing of the input on either a succesful match, a failed match or both. This parser does not add anything to the actual parsing but merely performs the specified actions where appropriate.

Author:
Martijn W. van der Lee

Constructor Summary
POnMatch(PParser parser, PAction action_match)
          Match-only constructor.
POnMatch(PParser parser, PAction action_match, PAction action_mismatch)
          Match and mismatch constructor.
 
Method Summary
 PMatch parse(PScanner input, long begin, PContext context)
           
 
Methods inherited from class pobs.PParser
addControl, getErrorInfo, process, setErrorInfo, setMatchAction, setMismatchAction
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

POnMatch

public POnMatch(PParser parser,
                PAction action_match)
Match-only constructor. Specifies only the action to be performed on a succesful match of the specified parser.

Parameters:
parser - a parser which may trigger the action
action_match - an action performed upon a succesful match

POnMatch

public POnMatch(PParser parser,
                PAction action_match,
                PAction action_mismatch)
Match and mismatch constructor. Specifies both the actions to be performed on a succesful match and on a mismatch of the specified parser.

Parameters:
parser - a parser which may trigger the action
action_match - an action performed upon a succesful match
action_mismatch - an action performed upon a failed match
Method Detail

parse

public PMatch parse(PScanner input,
                    long begin,
                    PContext context)
Parameters:
input - Input to be parsed.
begin - Index of first character of input to be parsed.
context - Parsing context.
Returns:
Parsing result.