|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface TokenStream
This interface describes the features of a stream capable of delivering
Tokens. In fact it is a push-back
stream since Tokens already read can be pushed back onto the stream for
further reading.
Nevertheless you should be aware that characters once coined into tokens are not changed – even if the tokenizer might produce another result in the meantime.
| Method Summary | |
|---|---|
boolean |
closeFileStream()
Close this stream if it is a file stream. |
Token |
get(TokenFactory factory,
Tokenizer tokenizer)
Get the next token from the token stream. |
Locator |
getLocator()
Getter for the locator. |
boolean |
isEof()
Check to see if a further token can be acquired from the token stream. |
boolean |
isEol()
Check to see if the token stream is currently at the end of line. |
boolean |
isFileStream()
Check whether the current stream is associated with a file to read from. |
void |
put(Token token)
Push back a token into the stream. |
| Method Detail |
|---|
boolean closeFileStream()
true if the closing was successful
Token get(TokenFactory factory,
Tokenizer tokenizer)
throws ScannerException
factory - the token factorytokenizer - the tokenizer
null if no more tokens are
available
ScannerException - in case of an errorLocator getLocator()
boolean isEof()
throws ScannerException
true if the stream is at its end
ScannerException - in case that an error has been encountered.
Especially if an IO exceptions occurs it is delivered as chained
exception in a ScannerException.
boolean isEol()
throws ScannerException
true if the stream is at end of line
ScannerException - in case that an error has been encountered.
Especially if an IO exceptions occurs it is delivered as chained
exception in a ScannerException.boolean isFileStream()
true if the stream is a file streamvoid put(Token token)
null then nothing happens:
a null token is not pushed!
Note that it is up to the implementation to accept tokens not produced with the token factory for push back. In general the behavior in such a case is not defined and should be avoided.
token - the token to push back
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||