pobs.parser
Class POptional

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

public class POptional
extends PParser

Matches succesful always, the length of the match is zero when the specified parser fails or the length of the specified parsers' succesful match. BNF: this := parser?

Author:
Martijn W. van der Lee

Constructor Summary
POptional(PObject parser)
          Sole 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

POptional

public POptional(PObject parser)
Sole constructor.

Parameters:
parser - a parser
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.