public abstract class Operation
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Operation.OpAtom
A match against a fixed string of any length
|
static class |
Operation.OpBackReference
Back-reference
|
static class |
Operation.OpBOL
Beginning of Line (^)
|
static class |
Operation.OpCapture
Open paren (captured group)
|
static class |
Operation.OpCharClass
A match of a single character in the input against a set of permitted characters
|
static class |
Operation.OpChoice
A choice of several branches
|
static class |
Operation.OpEndProgram
End of program
|
static class |
Operation.OpEOL
End of Line ($)
|
static class |
Operation.OpGreedyFixed
Handle a greedy repetition (with possible min and max) where the
size of the repeated unit is fixed.
|
static class |
Operation.OpNothing
Match empty string
|
static class |
Operation.OpReluctantFixed
Handle a reluctant repetition (with possible min and max) where the
size of the repeated unit is fixed.
|
static class |
Operation.OpRepeat
Handle a repetition (with possible min and max) where the
size of the repeated unit is variable.
|
static class |
Operation.OpSequence
A sequence of multiple pieces
|
static class |
Operation.OpTrace
Operation that wraps a base operation and traces its execution
|
static class |
Operation.OpUnambiguousRepeat
Handle a repetition where there is no ambiguity; if the repeated
term is matched in the string, then it cannot match anything other than
the repeated term.
|
Modifier and Type | Field and Description |
---|---|
static int |
MATCHES_ZLS_ANYWHERE |
static int |
MATCHES_ZLS_AT_END |
static int |
MATCHES_ZLS_AT_START |
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
|
public static final int MATCHES_ZLS_AT_START
public static final int MATCHES_ZLS_AT_END
public static final int MATCHES_ZLS_ANYWHERE
public 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-2020 Saxonica Limited. All rights reserved.