jpicedt.format.input.util
Class AbstractRegularExpression
java.lang.Object
jpicedt.format.input.util.AbstractRegularExpression
- Direct Known Subclasses:
- AlternateExpression, EnclosingExpression, LiteralExpression, NumericalExpression, OptionalExpression, PicEndExpression, PicPointExpression, PsObjectExpression, RegExExpression, RepeatExpression, SequenceExpression, StatementExpression, WildCharExpression, WordExpression
public abstract class AbstractRegularExpression
- extends Object
This is the abstract superclass for all regular expressions that may help building a RegExp-based parser.
It mimics the RegExp scheme, while at the same time allowing expressions to send ParserEvent's when
a piece of input text was successfully parsed (that is, instead of delegating to a separate ParserHandler
through a callback mechanism, events are handled in the core of the action
method).
A Context
is then used to feed successive pieces of text to the set of reg-exp's that build up
the grammar tree, and a Pool
allow reg-exp's to share data across the whole grammar tree.
- Since:
- jpicedt 1.3
- Version:
- $Id: AbstractRegularExpression.java,v 1.8 2013/03/31 07:00:10 vincentb1 Exp $
- Author:
- Sylvain Reynal
Method Summary |
void |
action(ParserEvent e)
Called in the course of the interpret operation at the end of a SUCCESSFUL interpret operation. |
abstract boolean |
interpret(Context c)
Parses this expression, possibly using the given Context to fetch the String to interpret
if this Expression is a leaf expression. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractRegularExpression
public AbstractRegularExpression()
interpret
public abstract boolean interpret(Context c)
throws REParserException
- Parses this expression, possibly using the given Context to fetch the String to interpret
if this Expression is a leaf expression.
- Returns:
- TRUE if parsing was successful
- Throws:
REParserException
- if an error occur during parsing
action
public void action(ParserEvent e)
throws REParserException
- Called in the course of the interpret operation at the end of a SUCCESSFUL interpret operation.
Should be overriden by daughter classes to process proper action, e.g. set Element's attributes…
Current implementation does nothing, but sending a debugging string.
- Throws:
REParserException
Submit a bug : syd@jpicedt.org