Class SequenceExpression

    • Constructor Detail

      • SequenceExpression

        public SequenceExpression()
        constructs a sequence that contains no sub-expression and doesn't throw IncompleteSequenceException
      • SequenceExpression

        public SequenceExpression​(boolean throwIncompleteSequenceException)
        constructs a sequence that contains no sub-expression.
        Parameters:
        throwIncompleteSequenceException - if TRUE, and if the first sub-expression has been found but any ensuing expression hasn't been found, throw a REParserException.IncompleteSequenceException.
      • SequenceExpression

        public SequenceExpression​(AbstractRegularExpression expr)
        constructs a sequence with the given expression as the first sub-expression and which doesn't throw IncompleteSequenceException.
      • SequenceExpression

        public SequenceExpression​(AbstractRegularExpression expr,
                                  boolean throwIncompleteSequenceException)
        constructs a sequence with the given expression as the first sub-expression.
        Parameters:
        throwIncompleteSequenceException - if TRUE, and if the first sub-expression has been found but any ensuing sub-expression hasn't been found, throw a REParserException.IncompleteSequenceException.
      • SequenceExpression

        public SequenceExpression​(AbstractRegularExpression expr1,
                                  AbstractRegularExpression expr2,
                                  boolean throwIncompleteSequenceException)
        constructs a sequence with the given expression as the first and second sub-expression
        Parameters:
        throwIncompleteSequenceException - if TRUE, and if the first sub-expression has been found but any ensuing sub-expression hasn't been found, throw a REParserException.IncompleteSequenceException.
      • SequenceExpression

        public SequenceExpression​(AbstractRegularExpression expr1,
                                  AbstractRegularExpression expr2,
                                  AbstractRegularExpression expr3,
                                  boolean throwIncompleteSequenceException)
        constructs a sequence with three sub-expressions
        Parameters:
        throwIncompleteSequenceException - if TRUE, and if the first sub-expression has been found but any ensuing sub-expression hasn't been found, throw a REParserException.IncompleteSequenceException.
    • Method Detail

      • interpret

        public boolean interpret​(Context c)
                          throws REParserException
        Description copied from class: AbstractRegularExpression
        Parses this expression, possibly using the given Context to fetch the String to interpret if this Expression is a leaf expression.
        Specified by:
        interpret in class AbstractRegularExpression
        Returns:
        TRUE if and only if every expression contained in this SequenceExpression were found, in the same order as they were added to the sequence. FALSE otherwise.
        Throws:
        REParserException.IncompleteSequence - if flag throwIncompleteSequenceException is TRUE and any expression but the first one wasn't found Whether TRUE or FALSE, calls action with key="&" and value=new Integer(index of last expression parsed with success)
        REParserException - if an error occur during parsing
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object