java.lang.Object
jpicedt.graphic.io.parser.AbstractRegularExpression
jpicedt.graphic.io.parser.TerminalExpression
- All Implemented Interfaces:
- ExpressionConstants
- public class TerminalExpression
- extends AbstractRegularExpression
This expression works a bit like a "CR-greedy" expression : it scans each line until
it can successfully parse the reg-exp given in the constructor, POSSIBLY preceded by wild-chars (as
given in the construror).
Say we create a new TerminalExpression(new LiteralExpression("%End Line")>/code> (as in
picedt.PicLineExpression
. Then this expression will drop every line (whatever it may contain)
until it finds "^(\s)*%End Line". Hence the type of WildCharExpression specified in the constructor
is solely used when parsing the beginning of each line
[pending] : would "CRGreedyExpression" be a more appropriate name ?
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 |
Method Summary |
boolean |
interpret(Context c)
Either :
- swallow CR's on empty line,
- or try to match the given expression,
- or try to swallow the given wildchars. |
java.lang.String |
toString()
Convert this Object to a human-readable String. |
expr
private AbstractRegularExpression expr
wildExpr
private AbstractRegularExpression wildExpr
leadingStr
private java.lang.String leadingStr
TerminalExpression
public TerminalExpression(AbstractRegularExpression expr)
- Calls TerminalExpression(expr, WHITESPACES) => "expr" can only be preceded by whitespaces
TerminalExpression
public TerminalExpression(AbstractRegularExpression expr,
int type)
interpret
public boolean interpret(Context c)
throws ParserException
- Either :
- swallow CR's on empty line,
- or try to match the given expression,
- or try to swallow the given wildchars.
- Specified by:
interpret
in class AbstractRegularExpression
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())
.