public abstract class Operation
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected static class |
Operation.ForceProgressIterator
The ForceProgressIterator is used to protect against non-termination; specifically,
iterators that return an infinite number of zero-length matches.
|
Modifier and Type | Field and Description |
---|---|
protected static int |
MATCHES_ZLS_ANYWHERE |
protected static int |
MATCHES_ZLS_AT_END |
protected static int |
MATCHES_ZLS_AT_START |
protected static int |
MATCHES_ZLS_NEVER |
Constructor and Description |
---|
Operation() |
Modifier and Type | Method and Description |
---|---|
boolean |
containsCapturingExpressions()
Ask whether the expression contains any capturing sub-expressions
|
abstract java.lang.String |
display()
Display the operation as a regular expression, possibly in abbreviated form
|
CharacterClass |
getInitialCharacterClass(boolean caseBlind)
Get a CharacterClass identifying the set of characters that can appear as the first
character of a non-empty string that matches this term.
|
int |
getMatchLength()
Get the length of the matches returned by this operation if they are fixed-length
|
int |
getMinimumMatchLength()
Get the minimum length of the matches returned by this operation
|
abstract IntIterator |
iterateMatches(REMatcher matcher,
int position)
Get an iterator returning all the matches for this operation
|
abstract int |
matchesEmptyString()
Ask whether the regular expression is known, after static analysis, to match a
zero-length string
|
Operation |
optimize(REProgram program,
REFlags flags)
Optimize the operation
|
protected static final int MATCHES_ZLS_AT_START
protected static final int MATCHES_ZLS_AT_END
protected static final int MATCHES_ZLS_ANYWHERE
protected static final int MATCHES_ZLS_NEVER
public abstract IntIterator iterateMatches(REMatcher matcher, int position)
matcher
- supplies the context for the matching; may be updated with information about
captured groupsposition
- the start position to seek a matchpublic int getMatchLength()
public int getMinimumMatchLength()
public abstract int matchesEmptyString()
MATCHES_ZLS_AT_START
if the expression is statically known to match a zero-length string at the
start of the supplied input;MATCHES_ZLS_AT_END
if it is statically known to return a zero-length
string at the end of the supplied input;MATCHES_ZLS_ANYWHERE
if it is statically known to match a zero-length string anywhere in the input.
MATCHES_ZLS_NEVER
if it is statically known that the
regex will never match a zero length string.public boolean containsCapturingExpressions()
public CharacterClass getInitialCharacterClass(boolean caseBlind)
caseBlind
- true if case-blind matching is in force ("i" flag)public Operation optimize(REProgram program, REFlags flags)
program
- the program being optimizedflags
- the regular expression flagspublic abstract java.lang.String display()
Copyright (c) 2004-2022 Saxonica Limited. All rights reserved.