- 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, lets it 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) Returns the token type of the token that the specifiedTranscriber
object reads.
-
Method Details
-
apply
Returns the token type of the token that the specifiedTranscriber
object reads.The transcriber reads 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, Tokenizer tokenizer) throws IOException { var type = tokenizer.apply(x); if (type == null) { return null; } return x.toToken(type); }
Note that this function may return
null
unlikeDefaultTokenizer.apply(Transcriber, SourceChar)
.- Parameters:
x
- The transcriber.- Returns:
null
if the transcriber's source has reached EOF. Otherwise, the token type.- Throws:
IOException
- If an I/O error occurs.
-