Package jpicedt.format.input.util
Class AbstractRegularExpression
- java.lang.Object
-
- jpicedt.format.input.util.AbstractRegularExpression
-
- All Implemented Interfaces:
ExpressionConstants
- Direct Known Subclasses:
AlternateExpression,EnclosingExpression,LiteralExpression,NumericalExpression,OptionalExpression,PicEndExpression,PicPointExpression,PsObjectExpression,RegExExpression,RepeatExpression,SequenceExpression,StatementExpression,WildCharExpression,WordExpression
public abstract class AbstractRegularExpression extends java.lang.Object implements ExpressionConstants
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 theactionmethod). AContextis then used to feed successive pieces of text to the set of reg-exp's that build up the grammar tree, and aPoolallow reg-exp's to share data across the whole grammar tree.- Since:
- jpicedt 1.3
- Version:
- $Id: AbstractRegularExpression.java,v 1.4.2.1 2007/09/02 11:56:13 reynal Exp $
- Author:
- Sylvain Reynal
-
-
Field Summary
-
Fields inherited from interface jpicedt.format.input.util.ExpressionConstants
ANY_CHAR, ANY_CHAR_EOL, ANY_SIGN, AT_LEAST, AT_MOST, DEBUG, DOUBLE, EOL, EXACTLY, INTEGER, NEGATIVE, NON_NULL, POSITIVE, STRICTLY_NEGATIVE, STRICTLY_POSITIVE, WHITE_SPACES, WHITE_SPACES_OR_EOL
-
-
Constructor Summary
Constructors Constructor Description AbstractRegularExpression()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaction(ParserEvent e)Called in the course of the interpret operation at the end of a SUCCESSFUL interpret operation.abstract booleaninterpret(Context c)Parses this expression, possibly using the given Context to fetch the String to interpret if this Expression is a leaf expression.
-
-
-
Method Detail
-
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
-
-