Module net.luis.utils
Record Class EscapedTokenDefinition
java.lang.Object
java.lang.Record
net.luis.utils.io.token.definition.EscapedTokenDefinition
- Record Components:
token- The escaped token character
- All Implemented Interfaces:
TokenDefinition,TokenRule
Token definition for escaped characters.
This token definition matches a string that starts with a backslash (\) and is followed by the token character.
Example:
This token definition matches a string that starts with a backslash (\) and is followed by the token character.
Example:
\<token> // Generic
\t // Tab
\n // New line
\\ // Backslash
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEscapedTokenDefinition(char token) Creates an instance of aEscapedTokenDefinitionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanChecks if the given word matches this token definition.chartoken()Returns the value of thetokenrecord component.@NotNull StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.luis.utils.io.token.definition.TokenDefinition
matchMethods inherited from interface net.luis.utils.io.token.rule.rules.TokenRule
optional, repeatAtLeast, repeatAtMost, repeatBetween, repeatExactly, repeatInfinitely
-
Field Details
-
token
private final char tokenThe field for thetokenrecord component.
-
-
Constructor Details
-
EscapedTokenDefinition
public EscapedTokenDefinition(char token) Creates an instance of aEscapedTokenDefinitionrecord class.- Parameters:
token- the value for thetokenrecord component
-
-
Method Details
-
matches
Description copied from interface:TokenDefinitionChecks if the given word matches this token definition.- Specified by:
matchesin interfaceTokenDefinition- Parameters:
word- The word to check- Returns:
- True if the word matches this token definition, false otherwise
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
token
public char token()Returns the value of thetokenrecord component.- Returns:
- the value of the
tokenrecord component
-