Class Token.Quantifier
java.lang.Object
com.oracle.truffle.regex.tregex.parser.Token
com.oracle.truffle.regex.tregex.parser.Token.Quantifier
-
Nested Class Summary
Nested classes/interfaces inherited from class com.oracle.truffle.regex.tregex.parser.Token
Token.BackReference, Token.CharacterClass, Token.CharacterClassAtom, Token.ClassSet, Token.InlineFlags, Token.Kind, Token.LiteralCharacter, Token.LiteralString, Token.LookAheadAssertionBegin, Token.LookAroundAssertionBegin, Token.LookBehindAssertionBegin, Token.Quantifier -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionQuantifier(int min, int max, boolean greedy, boolean possessive, boolean singleChar) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanintgetIndex()intgetMax()intgetMin()The minimum number of times the quantified element must appear.intinthashCode()booleanhasIndex()booleanbooleanisDead()Returnstrueif the quantified term can never match.booleanisGreedy()booleanbooleanbooleanReturnstrueiff the quantifier was created from a shorthand character, i.e.booleanReturnstrueiff "unrolling" this quantifier is trivial, i.e.booleanisWithinThreshold(int threshold) Returnstrueiff bothgetMin()andgetMax()are less or equal to the given threshold, or infiniteisInfiniteLoop().voidsetIndex(int index) voidsetZeroWidthIndex(int zeroWidthIndex) toJson()toString()Methods inherited from class com.oracle.truffle.regex.tregex.parser.Token
createA, createAlternation, createAtomicGroupBegin, createBackReference, createBackReference, createCaptureGroupBegin, createCaret, createCharacterClassAtom, createCharacterClassBegin, createCharacterClassEnd, createCharClass, createCharClass, createClassSetExpression, createConditionalBackReference, createDollar, createGroupEnd, createInlineFlags, createLineBreak, createLiteralCharacter, createLiteralString, createLookAheadAssertionBegin, createLookAheadAssertionBegin, createLookBehindAssertionBegin, createLookBehindAssertionBegin, createNonCaptureGroupBegin, createNonWordBoundary, createQuantifier, createWordBoundary, createZ, createZLowerCase, getPosition, getSourceSection, setPosition, setSourceSection
-
Field Details
-
INFINITY
public static final int INFINITY- See Also:
-
-
Constructor Details
-
Quantifier
public Quantifier(int min, int max, boolean greedy, boolean possessive, boolean singleChar)
-
-
Method Details
-
isInfiniteLoop
public boolean isInfiniteLoop() -
getMin
public int getMin()The minimum number of times the quantified element must appear. Can be -1 to represent a virtually infinite number of occurrences are necessary (e.g. as ina{1111111111111111111,}). Any number which is larger than the maximum size of the platform's String data type is considered "virtually infinite". -
getMax
public int getMax() -
isGreedy
public boolean isGreedy() -
isPossessive
public boolean isPossessive() -
isSingleChar
public boolean isSingleChar()Returnstrueiff the quantifier was created from a shorthand character, i.e. one of'?','*'or'+'. -
hasIndex
public boolean hasIndex() -
getIndex
public int getIndex() -
setIndex
public void setIndex(int index) -
hasZeroWidthIndex
public boolean hasZeroWidthIndex() -
getZeroWidthIndex
public int getZeroWidthIndex() -
setZeroWidthIndex
public void setZeroWidthIndex(int zeroWidthIndex) -
isWithinThreshold
public boolean isWithinThreshold(int threshold) Returnstrueiff bothgetMin()andgetMax()are less or equal to the given threshold, or infiniteisInfiniteLoop(). -
isUnrollTrivial
public boolean isUnrollTrivial()Returnstrueiff "unrolling" this quantifier is trivial, i.e. nothing has to be duplicated. This is the case for quantifiers?and*. -
isDead
public boolean isDead()Returnstrueif the quantified term can never match. This is the case when:- The minimum is virtually infinite (i.e. greater than the maximum string length).
- The minimum is larger than the maximum. This is usually a syntax error.
-
hashCode
-
equalsSemantic
-
equals
-
toString
-
toStringNoSuffix
-
toJson
- Specified by:
toJsonin interfaceJsonConvertible- Overrides:
toJsonin classToken
-