- 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.-
Method Summary
Modifier and TypeMethodDescriptionapply
(Transcriber x, SourceChar c) Returns the token type of the token composed of the specifiedSourceChar
and if needed the characters supplied from the specifiedTranscriber
object.
-
Method Details
-
apply
Returns the token type of the token composed of the specifiedSourceChar
and if needed the characters supplied from the specifiedTranscriber
object.The transcriber may read characters from its source to build a new token. It stores the building token in its
TokenBuilder
object. 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
null
unlikeTokenizer.apply(Transcriber)
.- Parameters:
x
- The transcriber.c
- The first character that theTranscriber
has 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.
-