Class BitSetMatcher
java.lang.Object
com.oracle.truffle.regex.tregex.matchers.CharMatcher
com.oracle.truffle.regex.tregex.matchers.InvertibleCharMatcher
com.oracle.truffle.regex.tregex.matchers.BitSetMatcher
Matcher that matches multiple characters with a common high byte using a bit set.
Example: characters
Example: characters
တ, ဠ, ူ have a common high byte 0x10, so they
are matched by this high byte and a bit set that matches 0x10, 0x20 and
0x30.-
Method Summary
Modifier and TypeMethodDescriptionstatic InvertibleCharMatchercreate(boolean invert, int highByte, long[] bitSet) Constructs a new bit-set-based character matcher.intConservatively estimate the equivalent number of integer comparisons of callingCharMatcher.match(int).long[]booleanmatch(int c) Check if a given code point matches thisCharMatcher.toString()Methods inherited from class com.oracle.truffle.regex.tregex.matchers.InvertibleCharMatcher
modifiersToString, result, result
-
Method Details
-
create
Constructs a new bit-set-based character matcher.- Parameters:
invert- seeInvertibleCharMatcher.highByte- the high byte common to all characters to match.bitSet- the bit set to match the low byte of the characters to match.- Returns:
- a new
BitSetMatcheror aNullHighByteBitSetMatcher.
-
getBitSet
public long[] getBitSet() -
match
public boolean match(int c) Description copied from class:CharMatcherCheck if a given code point matches thisCharMatcher.- Specified by:
matchin classCharMatcher- Parameters:
c- any code point.- Returns:
trueif the character matches.- See Also:
-
estimatedCost
public int estimatedCost()Description copied from class:CharMatcherConservatively estimate the equivalent number of integer comparisons of callingCharMatcher.match(int).- Specified by:
estimatedCostin classCharMatcher- Returns:
- the number of integer comparisons one call to
CharMatcher.match(int)is roughly equivalent to. Array loads are treated as two comparisons.
-
toString
-