http://www.jpicedt.org

jpicedt.format.input.util
Class EnclosingExpression

java.lang.Object
  extended by jpicedt.format.input.util.AbstractRegularExpression
      extended by 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 :

Since:
jpicedt 1.3
Version:
$Id: EnclosingExpression.java,v 1.7 2013/03/31 06:59:49 vincentb1 Exp $
Author:
Sylvain Reynal

Constructor Summary
EnclosingExpression(String openingDelimiter, AbstractRegularExpression child, String closingDelimiter)
           
EnclosingExpression(String openingDelimiter, AbstractRegularExpression child, String closingDelimiter, boolean noLineFeed)
           
 
Method Summary
 String getEnclosedString()
           
 boolean interpret(Context context)
          Call action() with value=enclosed string
 void setChild(AbstractRegularExpression child)
          Change the Expression that must be parsed inside the delimiters to the given expression (can be null)
 String toString()
           
 
Methods inherited from class jpicedt.format.input.util.AbstractRegularExpression
action
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EnclosingExpression

public EnclosingExpression(String openingDelimiter,
                           AbstractRegularExpression child,
                           String closingDelimiter,
                           boolean noLineFeed)
Parameters:
openingDelimiter - the opening delimiter
child - the Expression that must be parsed inside the delimiters (can be null)
closingDelimiter - the closing delimiter
noLineFeed - 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 delimiter
child - the Expression that must be parse inside the delimiter (can be null)
closingDelimiter - the closing delimiter Linefeeds are allowed.
Method Detail

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

http://www.jpicedt.org

Submit a bug : syd@jpicedt.org