Class ObservableXtextTokenStream

  extended by org.antlr.runtime.CommonTokenStream
      extended by org.eclipse.xtext.parser.antlr.XtextTokenStream
          extended by org.eclipse.xtext.ui.editor.contentassist.antlr.ObservableXtextTokenStream
All Implemented Interfaces:
org.antlr.runtime.IntStream, org.antlr.runtime.TokenStream

public class ObservableXtextTokenStream
extends XtextTokenStream

Sebastian Zarnekow - Initial contribution and API

Nested Class Summary
static interface ObservableXtextTokenStream.StreamListener
Nested classes/interfaces inherited from class org.eclipse.xtext.parser.antlr.XtextTokenStream
Field Summary
Fields inherited from class org.antlr.runtime.CommonTokenStream
channel, channelOverrideMap, discardOffChannelTokens, discardSet, lastMarker, p, tokens, tokenSource
Constructor Summary
ObservableXtextTokenStream(org.antlr.runtime.TokenSource tokenSource, int channel)
ObservableXtextTokenStream(org.antlr.runtime.TokenSource tokenSource, ITokenDefProvider tokenDefProvider)
Method Summary
 void consume()
          Move the input pointer to the next incoming token.
 ObservableXtextTokenStream.StreamListener getListener()
 int LA(int i)
          Get int at current input pointer + i ahead where i=1 is next int.
 int mark()
          Tell the stream to start buffering if it hasn't already.
 void rewind(int marker)
          Reset the stream so that next call to index would return marker.
 void setListener(ObservableXtextTokenStream.StreamListener listener)
Methods inherited from class org.eclipse.xtext.parser.antlr.XtextTokenStream
doSetHiddenTokens, getCurrentLookAhead, getLexerErrorMessage, initCurrentLookAhead, LT, seek, setHiddenTokens, setInitialHiddenTokens, skipHiddenTokens, toString
Methods inherited from class org.antlr.runtime.CommonTokenStream
discardOffChannelTokens, discardTokenType, fillBuffer, get, getSourceName, getTokens, getTokens, getTokens, getTokens, getTokens, getTokenSource, index, LB, release, reset, rewind, setTokenSource, setTokenTypeChannel, size, skipOffTokenChannels, skipOffTokenChannelsReverse, toString, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public ObservableXtextTokenStream()


public ObservableXtextTokenStream(org.antlr.runtime.TokenSource tokenSource,
                                  int channel)


public ObservableXtextTokenStream(org.antlr.runtime.TokenSource tokenSource,
                                  ITokenDefProvider tokenDefProvider)
Method Detail


public int LA(int i)
Description copied from interface: org.antlr.runtime.IntStream
Get int at current input pointer + i ahead where i=1 is next int. Negative indexes are allowed. LA(-1) is previous token (token just matched). LA(-i) where i is before first token should yield -1, invalid char / EOF.

Specified by:
LA in interface org.antlr.runtime.IntStream
LA in class XtextTokenStream


public int mark()
Description copied from interface: org.antlr.runtime.IntStream
Tell the stream to start buffering if it hasn't already. Return current input position, index(), or some other marker so that when passed to rewind() you get back to the same spot. rewind(mark()) should not affect the input cursor. The Lexer track line/col info as well as input index so its markers are not pure input indexes. Same for tree node streams.

Specified by:
mark in interface org.antlr.runtime.IntStream
mark in class XtextTokenStream


public void rewind(int marker)
Description copied from interface: org.antlr.runtime.IntStream
Reset the stream so that next call to index would return marker. The marker will usually be index() but it doesn't have to be. It's just a marker to indicate what state the stream was in. This is essentially calling release() and seek(). If there are markers created after this marker argument, this routine must unroll them like a stack. Assume the state the stream was in when this marker was created.

Specified by:
rewind in interface org.antlr.runtime.IntStream
rewind in class org.antlr.runtime.CommonTokenStream


public void consume()
Description copied from class: org.antlr.runtime.CommonTokenStream
Move the input pointer to the next incoming token. The stream must become active with LT(1) available. consume() simply moves the input pointer so that LT(1) points at the next input symbol. Consume at least one token. Walk past any token not on the channel the parser is listening to.

Specified by:
consume in interface org.antlr.runtime.IntStream
consume in class XtextTokenStream


public void setListener(ObservableXtextTokenStream.StreamListener listener)


public ObservableXtextTokenStream.StreamListener getListener()