org.eclipse.xtext.ide.editor.contentassist.antlr.LookAheadTerminal Java Examples

The following examples show how to use org.eclipse.xtext.ide.editor.contentassist.antlr.LookAheadTerminal. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CustomN4JSParser.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
private ObservableXtextTokenStream toTokenStream(FollowElement element,
		ITokenDefProvider tokenDefProvider) {
	Iterator<LookAheadTerminal> iter = element.getLookAheadTerminals().iterator();
	return new ObservableXtextTokenStream(new TokenSource() {
		@Override
		public Token nextToken() {
			if (iter.hasNext()) {
				LookAheadTerminal lookAhead = iter.next();
				return lookAhead.getToken();
			}
			return Token.EOF_TOKEN;
		}

		@Override
		public String getSourceName() {
			return "LookAheadTerminalTokenSource";
		}
	}, tokenDefProvider);
}
 
Example #2
Source File: AbstractInternalContentAssistParser.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected LookAheadTerminal doCreateLookAheadTerminal(Token token) {
	return createLookAheadTerminal(token);
}