Interface Scanner
- All Known Implementing Classes:
ScannerImpl
-
Method Summary
Modifier and TypeMethodDescriptionbooleancheckToken(Token.ID... choices) Check if the next token is one of the given types.next()Returns the next token.Return the next token, but do not delete it from the stream.voidSet the document index to 0 after a document endMethods inherited from interface Iterator
forEachRemaining, hasNext, remove
-
Method Details
-
checkToken
Check if the next token is one of the given types.- Parameters:
choices- token IDs to match with- Returns:
trueif the next token is one of the given types. Returnsfalseif no more tokens are available.- Throws:
ScannerException- Thrown in case of malformed input.
-
peekToken
Token peekToken()Return the next token, but do not delete it from the stream.- Returns:
- The token that will be returned on the next call to
next() - Throws:
ScannerException- Thrown in case of malformed input.IndexOutOfBoundsException- if no more token left
-
next
Token next()Returns the next token.The token will be removed from the stream. (Every invocation of this method must happen after calling either
checkToken(Token.ID...)orpeekToken()- Specified by:
nextin interfaceIterator<Token>- Returns:
- the coming token
- Throws:
ScannerException- Thrown in case of malformed input.IndexOutOfBoundsException- if no more token left
-
resetDocumentIndex
void resetDocumentIndex()Set the document index to 0 after a document end
-