|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.antlr.runtime.BufferedTokenStream
jaitools.jiffle.parser.MultiChannelTokenStream
public final class MultiChannelTokenStream
A TokenStream that can work with multiple active channels.
Adapted from ANTLR's CommonTokenStream class.
| Field Summary | |
|---|---|
protected List<Integer> |
activeChannels
The List of active channel indices. |
| Fields inherited from class org.antlr.runtime.BufferedTokenStream |
|---|
lastMarker, p, range, tokens, tokenSource |
| Constructor Summary | |
|---|---|
MultiChannelTokenStream(org.antlr.runtime.TokenSource tokenSource)
Creates a new stream with the default ANTLR channel active. |
|
MultiChannelTokenStream(org.antlr.runtime.TokenSource tokenSource,
int[] channels)
Creates a new stream with the given channels active. |
|
| Method Summary | |
|---|---|
void |
addActiveChannel(int channelNum)
Adds a channel to those active. |
void |
consume()
|
boolean |
isActiveChannel(int channelNum)
Tests if a channel is active. |
protected org.antlr.runtime.Token |
LB(int k)
Looks backwards for the kth token on any of the active channels. |
org.antlr.runtime.Token |
LT(int k)
Looks forwards for the kth token on any of the active channels. |
void |
removeActiveChannel(int channelNum)
Removes a channel from those active. |
void |
removeAllActiveChannels()
Removes all active channels. |
void |
setTokenSource(org.antlr.runtime.TokenSource tokenSource)
|
protected void |
setup()
Positions the stream at the first token on an active channel. |
protected int |
skipOffTokenChannels(int pos)
Gets the index of the next token on an active channel, starting from pos. |
protected int |
skipOffTokenChannelsReverse(int pos)
Gets the index of the next token on an active channel, starting from pos and scanning backwards. |
| Methods inherited from class org.antlr.runtime.BufferedTokenStream |
|---|
fetch, fill, get, get, getSourceName, getTokens, getTokens, getTokens, getTokens, getTokens, getTokenSource, index, LA, mark, range, release, reset, rewind, rewind, seek, size, sync, toString, toString, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final List<Integer> activeChannels
List of active channel indices. These should all be positive
and less than 99 (used by ANTLR to flag its hidden token channel).
| Constructor Detail |
|---|
public MultiChannelTokenStream(org.antlr.runtime.TokenSource tokenSource)
tokenSource - a lexer
public MultiChannelTokenStream(org.antlr.runtime.TokenSource tokenSource,
int[] channels)
tokenSource - a lexerchannels - active channel indices| Method Detail |
|---|
public void consume()
consume in interface org.antlr.runtime.IntStreamconsume in class org.antlr.runtime.BufferedTokenStreamprotected org.antlr.runtime.Token LB(int k)
kth token on any of the active channels.
LB in class org.antlr.runtime.BufferedTokenStreamk - number of active-channel tokens to scan over
public org.antlr.runtime.Token LT(int k)
kth token on any of the active channels.
LT in interface org.antlr.runtime.TokenStreamLT in class org.antlr.runtime.BufferedTokenStreamk - number of active-channel tokens to scan over
protected int skipOffTokenChannels(int pos)
pos.
pos - start token index
protected int skipOffTokenChannelsReverse(int pos)
pos and scanning backwards.
pos - start token index
protected void setup()
setup in class org.antlr.runtime.BufferedTokenStreampublic void setTokenSource(org.antlr.runtime.TokenSource tokenSource)
setTokenSource in class org.antlr.runtime.BufferedTokenStreampublic void addActiveChannel(int channelNum)
channelNum - the channel to addpublic void removeActiveChannel(int channelNum)
channelNum - the channel to removepublic boolean isActiveChannel(int channelNum)
channelNum - the channel to test
true if the channel is active; false otherwisepublic void removeAllActiveChannels()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||