- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
The function that changes the state of the specified
Transcriber
object with the specified SourceChar object, lets the
Transcriber object read characters from its source and store a new
token in its builder, and returns the token type of the stored token.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionapply(Transcriber x, SourceChar c) Returns the token type of the token composed of the specifiedSourceCharand if needed the characters supplied from the specifiedTranscriberobject.
-
Method Details
-
apply
Returns the token type of the token composed of the specifiedSourceCharand if needed the characters supplied from the specifiedTranscriberobject.The transcriber may read characters from its source to build a new token. It stores the building token in its
TokenBuilderobject. So useTranscriber.toToken(TokenType)method to get the new token object as follows:Token newToken(Transcriber x, SourceChar c, DefaultTokenizer otherwise) throws IOException { var type = otherwise.apply(x, c); return x.toToken(type); }Note that this function does not return
nullunlikeTokenizer.apply(Transcriber).- Parameters:
x- The transcriber.c- The first character that theTranscriberhas read from its source but has not yet been stored to its builder.- Returns:
- The token type.
- Throws:
IOException- If an I/O error occurs.
-