pobs.parser
Class POnMatch
java.lang.Object
pobs.PParser
pobs.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
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 actionaction_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 actionaction_match
- an action performed upon a succesful matchaction_mismatch
- an action performed upon a failed match
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.