jpicedt.format.input.util
Class EnclosingExpression
java.lang.Object
jpicedt.format.input.util.AbstractRegularExpression
jpicedt.format.input.util.EnclosingExpression
- All Implemented Interfaces:
- ExpressionConstants
- public class EnclosingExpression
- extends AbstractRegularExpression
An expression that can encompass a sub-expression it encloses with markers, e.g. "{" + sub-expression + "}"
The interpret() methods work as follows :
- look up an endMarker matching beginMarker in Context.getRemainingSubstring (that is, skip enclosed blocks with the same markers type)
- set this endMarker as the new Context's endMarker
- save enclosed expression as "value", and interpret it
- restore old Context's endMarker
- Since:
- jpicedt 1.3
- Version:
- $Id: EnclosingExpression.java,v 1.4.2.1 2007/09/02 11:56:13 reynal Exp $
- Author:
- Sylvain Reynal
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 |
EnclosingExpression
public EnclosingExpression(String openingDelimiter,
AbstractRegularExpression child,
String closingDelimiter,
boolean noLineFeed)
- Parameters:
openingDelimiter
- the opening delimiterchild
- the Expression that must be parsed inside the delimiters (can be null)closingDelimiter
- the closing delimiternoLineFeed
- if true, closingDelimiter must be on the same line as openingDelimiter
A typical use would be : EnclosingExpression("{", new WildChar(ANY_CHAR),"}",false)
EnclosingExpression
public EnclosingExpression(String openingDelimiter,
AbstractRegularExpression child,
String closingDelimiter)
- Parameters:
openingDelimiter
- the opening delimiterchild
- the Expression that must be parse inside the delimiter (can be null)closingDelimiter
- the closing delimiter
Linefeeds are allowed.
setChild
public void setChild(AbstractRegularExpression child)
- Change the Expression that must be parsed inside the delimiters
to the given expression (can be null)
interpret
public boolean interpret(Context context)
throws REParserException
- Call action() with value=enclosed string
- Specified by:
interpret
in class AbstractRegularExpression
- Returns:
- TRUE if delimiters as well as inward expr have been found,
- Throws:
REParserException
- if an error occur during parsing
getEnclosedString
public String getEnclosedString()
- Returns:
- the enclosed string (= block content as returned by Context)
toString
public String toString()
Submit a bug : syd@jpicedt.org