Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| http://www.jpicedt.org
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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

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
`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()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| http://www.jpicedt.org
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Submit a bug : syd@jpicedt.org