org.eclipse.xtext.ui.editor.contentassist.antlr
Class ObservableXtextTokenStream

java.lang.Object
  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

Author:
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
XtextTokenStream.HiddenTokens
 
Field Summary
 
Fields inherited from class org.antlr.runtime.CommonTokenStream
channel, channelOverrideMap, discardOffChannelTokens, discardSet, lastMarker, p, tokens, tokenSource
 
Constructor Summary
ObservableXtextTokenStream()
           
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

ObservableXtextTokenStream

public ObservableXtextTokenStream()

ObservableXtextTokenStream

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

ObservableXtextTokenStream

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

LA

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
Overrides:
LA in class XtextTokenStream

mark

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
Overrides:
mark in class XtextTokenStream

rewind

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
Overrides:
rewind in class org.antlr.runtime.CommonTokenStream

consume

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
Overrides:
consume in class XtextTokenStream

setListener

public void setListener(ObservableXtextTokenStream.StreamListener listener)

getListener

public ObservableXtextTokenStream.StreamListener getListener()