java.lang.Object
jpicedt.graphic.io.parser.AbstractRegularExpression
jpicedt.graphic.io.parser.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
Fields inherited from interface jpicedt.graphic.io.parser.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 |
value
private java.lang.String value
openingDelimiter
private java.lang.String openingDelimiter
closingDelimiter
private java.lang.String closingDelimiter
child
private AbstractRegularExpression child
noLineFeed
private boolean noLineFeed
EnclosingExpression
public EnclosingExpression(java.lang.String openingDelimiter,
AbstractRegularExpression child,
java.lang.String closingDelimiter,
boolean noLineFeed)
EnclosingExpression
public EnclosingExpression(java.lang.String openingDelimiter,
AbstractRegularExpression child,
java.lang.String closingDelimiter)
setChild
public void setChild(AbstractRegularExpression child)
- Change the child of this expression to the given expression
interpret
public boolean interpret(Context context)
throws ParserException
- Call action() with value=enclosed string
- Specified by:
interpret
in class AbstractRegularExpression
getEnclosedString
public java.lang.String getEnclosedString()
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object
- Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method
never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string
concatenation with this object. If the result is
null
, string concatenation will instead
use "null"
.
The default implementation returns
getClass().getName() + "@" +
Integer.toHexString(hashCode())
.