Class FilterTokenSource
java.lang.Object
io.github.douira.glsl_transformer.transform.FilterTokenSource
- All Implemented Interfaces:
TokenSource
The filter token source wraps another token source but reads tokens from it
until a given filter accepts one. When it encounters EOF it immediately
returns it.
-
Constructor Summary
ConstructorsConstructorDescriptionFilterTokenSource(TokenSource tokenSource) Creates a new filtering token source with a given token source to wrap. -
Method Summary
Modifier and TypeMethodDescriptionintintgetLine()TokenFactory<?>UsesTokenSource.nextToken()on the real token source to filter to get tokens and then filters them with the contained token filter if there is one.voidsetTokenFactory(TokenFactory<?> factory) voidsetTokenFilter(TokenFilter<?> tokenFilter) Sets the token filter on this filtering token source wrapper.voidsetTokenSource(TokenSource tokenSource) Sets the token source on this filtering token source wrapper.
-
Constructor Details
-
FilterTokenSource
Creates a new filtering token source with a given token source to wrap.- Parameters:
tokenSource- The real token source to get tokens from
-
-
Method Details
-
setTokenSource
Sets the token source on this filtering token source wrapper. May not benull.- Parameters:
tokenSource- The new token source
-
setTokenFilter
Sets the token filter on this filtering token source wrapper. Set tonullto effectively disable any manipulation of the tokens generated by the contained token source.- Parameters:
tokenFilter- The new token filter
-
nextToken
UsesTokenSource.nextToken()on the real token source to filter to get tokens and then filters them with the contained token filter if there is one.- Specified by:
nextTokenin interfaceTokenSource
-
getLine
public int getLine()- Specified by:
getLinein interfaceTokenSource
-
getCharPositionInLine
public int getCharPositionInLine()- Specified by:
getCharPositionInLinein interfaceTokenSource
-
getInputStream
- Specified by:
getInputStreamin interfaceTokenSource
-
getSourceName
- Specified by:
getSourceNamein interfaceTokenSource
-
setTokenFactory
- Specified by:
setTokenFactoryin interfaceTokenSource
-
getTokenFactory
- Specified by:
getTokenFactoryin interfaceTokenSource
-