public abstract class ChannelTokenSource extends Object implements org.antlr.v4.runtime.TokenSource
TokenSource that wraps another TokenSource, only allowing tokens through if they
match the expected channel.
This class is necessary when using the UnbufferedTokenStream to parse extremely large files, because
that class does not filter out e.g. whitespace and comments.
| Constructor and Description |
|---|
ChannelTokenSource() |
| Modifier and Type | Method and Description |
|---|---|
int |
getCharPositionInLine() |
org.antlr.v4.runtime.CharStream |
getInputStream() |
int |
getLine() |
String |
getSourceName() |
org.antlr.v4.runtime.TokenFactory<?> |
getTokenFactory() |
org.antlr.v4.runtime.Token |
nextToken() |
static ChannelTokenSource |
of(org.antlr.v4.runtime.TokenSource source) |
static ChannelTokenSource |
of(org.antlr.v4.runtime.TokenSource source,
int channel) |
void |
setTokenFactory(org.antlr.v4.runtime.TokenFactory<?> factory) |
public static ChannelTokenSource of(org.antlr.v4.runtime.TokenSource source)
public static ChannelTokenSource of(org.antlr.v4.runtime.TokenSource source, int channel)
public org.antlr.v4.runtime.Token nextToken()
nextToken in interface org.antlr.v4.runtime.TokenSourcepublic int getLine()
getLine in interface org.antlr.v4.runtime.TokenSourcepublic int getCharPositionInLine()
getCharPositionInLine in interface org.antlr.v4.runtime.TokenSourcepublic org.antlr.v4.runtime.CharStream getInputStream()
getInputStream in interface org.antlr.v4.runtime.TokenSourcepublic String getSourceName()
getSourceName in interface org.antlr.v4.runtime.TokenSourcepublic void setTokenFactory(org.antlr.v4.runtime.TokenFactory<?> factory)
setTokenFactory in interface org.antlr.v4.runtime.TokenSourcepublic org.antlr.v4.runtime.TokenFactory<?> getTokenFactory()
getTokenFactory in interface org.antlr.v4.runtime.TokenSourceCopyright © 2017 Grakn Labs Ltd. All rights reserved.