jpicedt.format.input.util
Class EnclosingExpression
java.lang.Object
jpicedt.format.input.util.AbstractRegularExpression
jpicedt.format.input.util.EnclosingExpression
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.7 2013/03/31 06:59:49 vincentb1 Exp $
- Author:
- Sylvain Reynal
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()
- Overrides:
toString
in class Object
Submit a bug : syd@jpicedt.org