|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pobs.PParser
Abstract base class of all parsers. It handles directives and optional
actions. Concrete subclasses must implement
#parse(PScanner, long, PContext)
.
setErrorInfo(String)
,addControl(PControl)
,
setMatchAction(PAction)
, and setMismatchAction(PAction)
must be called before the first invocation of
process(PScanner, long, PContext)
.PControls
and PActions
must be stateless
objects.#parse(PScanner, long, PContext)
never changes the internal state of a
PParser
object.
Constructor Summary | |
PParser()
|
Method Summary | |
PParser |
addControl(PControl control)
Adds a control. |
java.lang.String |
getErrorInfo()
Returns the error information. |
PMatch |
process(PScanner input,
long begin,
PContext context)
Parses specified input and invokes actions if defined. |
PParser |
setErrorInfo(java.lang.String errorInfo)
Sets an error info. |
PParser |
setMatchAction(PAction matchAction)
Defines the action used in the case of matching. |
PParser |
setMismatchAction(PAction mismatchAction)
Defines the action used in the case of missmatching. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PParser()
Method Detail |
public final PParser addControl(PControl control)
public java.lang.String getErrorInfo()
public PMatch process(PScanner input, long begin, PContext context)
#parse(PScanner, long, PContext)
is invoked. Depending on the
result the matching or missmatching action is invoked with the
PTarget
of context
.
process
in interface PObject
input
- a PScanner which contains the entire input sequencebegin
- the index location into the input from where to start
processingcontext
- the current processing context
PMatch
public PParser setErrorInfo(java.lang.String errorInfo)
errorInfo
- Error info which will be used by PErrorHandler
. Can
be null
.
public final PParser setMatchAction(PAction matchAction)
matchAction
- Action invoked in case of a successful match. Can be
null
.
public final PParser setMismatchAction(PAction mismatchAction)
mismatchAction
- Action invoked in case of a unsuccessful match. Can be
null
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |