java.lang.Object
net.luis.utils.io.token.rule.rules.AlwaysMatchTokenRule
- All Implemented Interfaces:
TokenRule
A token rule that always matches a single token if the start index is valid.
This rule is useful for testing or as a default case in a chain of token rules.
This class is implemented as a singleton and can be accessed via
This rule is useful for testing or as a default case in a chain of token rules.
This class is implemented as a singleton and can be accessed via
TokenRules.alwaysMatch()
or INSTANCE
.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AlwaysMatchTokenRule
The singleton instance of this class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Private constructor to prevent instantiation. -
Method Summary
Modifier and TypeMethodDescription@Nullable TokenRuleMatch
Checks if the given tokens match this rule starting from the specified index.
If the match is successful, aTokenRuleMatch
is returned, otherwise null.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.luis.utils.io.token.rule.rules.TokenRule
optional, repeatAtLeast, repeatAtMost, repeatBetween, repeatExactly, repeatInfinitely
-
Field Details
-
INSTANCE
The singleton instance of this class.
-
-
Constructor Details
-
AlwaysMatchTokenRule
private AlwaysMatchTokenRule()Private constructor to prevent instantiation.
-
-
Method Details
-
match
@Nullable public @Nullable TokenRuleMatch match(@NotNull @NotNull List<Token> tokens, int startIndex) Description copied from interface:TokenRule
Checks if the given tokens match this rule starting from the specified index.
If the match is successful, aTokenRuleMatch
is returned, otherwise null.
-