Class OpRepeat

    • Field Detail

      • min

        protected int min
      • max

        protected int max
    • Method Detail

      • matchesEmptyString

        public int matchesEmptyString()
        Description copied from class: Operation
        Ask whether the regular expression is known, after static analysis, to match a zero-length string
        Specified by:
        matchesEmptyString in class Operation
        Returns:
        a value indicating whether the regex is statically known to match a zero-length string. Specifically: Returning 0 means that it is not known statically whether or not the regex will match a zero-length string; this case typically arises when back-references are involved.
      • containsCapturingExpressions

        public boolean containsCapturingExpressions()
        Description copied from class: Operation
        Ask whether the expression contains any capturing sub-expressions
        Overrides:
        containsCapturingExpressions in class Operation
        Returns:
        true if the expression contains any capturing sub-expressions (but not if it is a capturing expression itself, unless it contains nested capturing expressions)
      • getInitialCharacterClass

        public CharacterClass getInitialCharacterClass​(boolean caseBlind)
        Description copied from class: Operation
        Get a CharacterClass identifying the set of characters that can appear as the first character of a non-empty string that matches this term. This is allowed to be an over-estimate (that is, the returned Character class must match every character that can legitimately appear at the start of the matched string, but it can also match other characters).
        Overrides:
        getInitialCharacterClass in class Operation
        Parameters:
        caseBlind - true if case-blind matching is in force ("i" flag)
      • getMatchLength

        public int getMatchLength()
        Description copied from class: Operation
        Get the length of the matches returned by this operation if they are fixed-length
        Overrides:
        getMatchLength in class Operation
        Returns:
        the length of the matches, or -1 if the length is variable
      • getMinimumMatchLength

        public int getMinimumMatchLength()
        Description copied from class: Operation
        Get the minimum length of the matches returned by this operation
        Overrides:
        getMinimumMatchLength in class Operation
        Returns:
        the length of the shortest string that will match the operation
      • getMaxLoopingDepth

        public int getMaxLoopingDepth()
        Get the maximum depth of looping within this operation
        Overrides:
        getMaxLoopingDepth in class Operation
        Returns:
        the maximum number of nested iterations
      • optimize

        public Operation optimize​(REProgram program,
                                  REFlags flags)
        Description copied from class: Operation
        Optimize the operation
        Overrides:
        optimize in class Operation
        Parameters:
        program - the program being optimized
        flags - the regular expression flags
        Returns:
        the optimized operation
      • iterateMatches

        public IntIterator iterateMatches​(REMatcher matcher,
                                          int position)
        Description copied from class: Operation
        Get an iterator returning all the matches for this operation
        Specified by:
        iterateMatches in class Operation
        Parameters:
        matcher - supplies the context for the matching; may be updated with information about captured groups
        position - the start position to seek a match
        Returns:
        an iterator returning the endpoints of all matches starting at the supplied position
      • display

        public java.lang.String display()
        Display the operation as a regular expression, possibly in abbreviated form
        Specified by:
        display in class Operation
        Returns:
        the operation in a form that is recognizable as a regular expression or abbreviated regular expression