org.eclipse.xtext.parser.antlr.AntlrTokenDefProvider Java Examples

The following examples show how to use org.eclipse.xtext.parser.antlr.AntlrTokenDefProvider. 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: AntlrGeneratorFragment.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Set<Binding> getGuiceBindingsRt(Grammar grammar) {
	BindFactory factory = new BindFactory()
		.addTypeToType(IParser.class.getName(),getFragmentHelper().getParserClassName(grammar))
		.addTypeToType(ITokenToStringConverter.class.getName(),AntlrTokenToStringConverter.class.getName())
		.addTypeToType(IAntlrTokenFileProvider.class.getName(),getFragmentHelper().getAntlrTokenFileProviderClassName(grammar))
		.addTypeToType(Lexer.class.getName(), getFragmentHelper().getLexerClassName(grammar))
		.addTypeToProviderInstance(getFragmentHelper().getLexerClassName(grammar), "org.eclipse.xtext.parser.antlr.LexerProvider.create(" + getFragmentHelper().getLexerClassName(grammar) + ".class)")
		.addConfiguredBinding("RuntimeLexer",
				"binder.bind(" + Lexer.class.getName() + ".class)"+
				".annotatedWith(com.google.inject.name.Names.named(" +
				"org.eclipse.xtext.parser.antlr.LexerBindings.RUNTIME" +
				")).to(" + getFragmentHelper().getLexerClassName(grammar) +".class)")
		.addTypeToType(ITokenDefProvider.class.getName(),AntlrTokenDefProvider.class.getName());
	if (containsUnorderedGroup(grammar))
		factory = factory.addTypeToType(IUnorderedGroupHelper.class.getName(), UnorderedGroupHelper.class.getName());
	if (getOptions().isIgnoreCase()) {
		factory = factory
			.addTypeToType(ITokenSerializer.IKeywordSerializer.class.getName(), IgnoreCaseKeywordSerializer.class.getName())
			.addTypeToType(AbstractIDValueConverter.class.getName(), IgnoreCaseIDValueConverter.class.getName());
	}
	return factory.getBindings();
}
 
Example #2
Source File: PresentationDamagerTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Document createDocument(final String before) throws Exception {
  XtextDocument _xblockexpression = null;
  {
    XtendDocumentTokenSource _xtendDocumentTokenSource = new XtendDocumentTokenSource();
    final Procedure1<XtendDocumentTokenSource> _function = (XtendDocumentTokenSource it) -> {
      AntlrTokenDefProvider _antlrTokenDefProvider = new AntlrTokenDefProvider();
      final Procedure1<AntlrTokenDefProvider> _function_1 = (AntlrTokenDefProvider it_1) -> {
        XtendAntlrTokenFileProvider _xtendAntlrTokenFileProvider = new XtendAntlrTokenFileProvider();
        it_1.setAntlrTokenFileProvider(_xtendAntlrTokenFileProvider);
      };
      AntlrTokenDefProvider _doubleArrow = ObjectExtensions.<AntlrTokenDefProvider>operator_doubleArrow(_antlrTokenDefProvider, _function_1);
      it.setTokenDefProvider(_doubleArrow);
      final Provider<Lexer> _function_2 = () -> {
        return this.createLexer();
      };
      it.setLexer(_function_2);
      it.setFlexerFactory(this.flexerFactory);
    };
    final XtendDocumentTokenSource source = ObjectExtensions.<XtendDocumentTokenSource>operator_doubleArrow(_xtendDocumentTokenSource, _function);
    final XtextDocument document = new XtextDocument(source, null, this.outdatedStateManager, this.operationCanceledManager);
    document.set(before);
    _xblockexpression = document;
  }
  return _xblockexpression;
}
 
Example #3
Source File: AntlrGeneratorFragment.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Set<Binding> getGuiceBindingsUi(Grammar grammar) {
	return new BindFactory()
		.addTypeToType("org.eclipse.xtext.ui.editor.contentassist.IProposalConflictHelper", "org.eclipse.xtext.ui.editor.contentassist.antlr.AntlrProposalConflictHelper")
		.addConfiguredBinding("HighlightingLexer",
				"binder.bind(" + Lexer.class.getName() + ".class)"+
				".annotatedWith(com.google.inject.name.Names.named(" +
				"org.eclipse.xtext.ui.LexerUIBindings.HIGHLIGHTING" +
				")).to(" + getFragmentHelper().getLexerClassName(grammar) +".class)")
		.addConfiguredBinding("HighlightingTokenDefProvider",
				"binder.bind(" + ITokenDefProvider.class.getName() + ".class)"+
				".annotatedWith(com.google.inject.name.Names.named(" +
				"org.eclipse.xtext.ui.LexerUIBindings.HIGHLIGHTING" +
				")).to(" + AntlrTokenDefProvider.class.getName() +".class)")
		.getBindings();
}
 
Example #4
Source File: DocumentRewriterTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
protected XtextDocument createDocument(final String content) throws Exception {
  XtextDocument _xblockexpression = null;
  {
    final IFile file = this._workbenchTestHelper.createFile("Foo", content);
    final Resource resource = this._workbenchTestHelper.getResourceSet().getResource(URI.createPlatformResourceURI(file.getFullPath().toString(), true), true);
    XtendDocumentTokenSource _xtendDocumentTokenSource = new XtendDocumentTokenSource();
    final Procedure1<XtendDocumentTokenSource> _function = (XtendDocumentTokenSource it) -> {
      AntlrTokenDefProvider _antlrTokenDefProvider = new AntlrTokenDefProvider();
      final Procedure1<AntlrTokenDefProvider> _function_1 = (AntlrTokenDefProvider it_1) -> {
        XtendAntlrTokenFileProvider _xtendAntlrTokenFileProvider = new XtendAntlrTokenFileProvider();
        it_1.setAntlrTokenFileProvider(_xtendAntlrTokenFileProvider);
      };
      AntlrTokenDefProvider _doubleArrow = ObjectExtensions.<AntlrTokenDefProvider>operator_doubleArrow(_antlrTokenDefProvider, _function_1);
      it.setTokenDefProvider(_doubleArrow);
      final Provider<Lexer> _function_2 = () -> {
        InternalXtendLexer _internalXtendLexer = new InternalXtendLexer();
        return ((Lexer) _internalXtendLexer);
      };
      it.setLexer(_function_2);
      it.setFlexerFactory(this.flexerFactory);
    };
    final XtendDocumentTokenSource source = ObjectExtensions.<XtendDocumentTokenSource>operator_doubleArrow(_xtendDocumentTokenSource, _function);
    final XtextDocument document = new XtextDocument(source, null, this.outdatedStateManager, this.operationCanceledManager);
    document.set(content);
    document.setInput(((XtextResource) resource));
    _xblockexpression = document;
  }
  return _xblockexpression;
}
 
Example #5
Source File: AbstractMultiGenMMTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ITokenDefProvider> bindITokenDefProvider() {
	return AntlrTokenDefProvider.class;
}
 
Example #6
Source File: AbstractPartialContentAssistTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ITokenDefProvider> bindITokenDefProvider() {
	return AntlrTokenDefProvider.class;
}
 
Example #7
Source File: AbstractEncodingUiTestLanguageUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureHighlightingTokenDefProvider(Binder binder) {
	binder.bind(ITokenDefProvider.class)
		.annotatedWith(Names.named(LexerIdeBindings.HIGHLIGHTING))
		.to(AntlrTokenDefProvider.class);
}
 
Example #8
Source File: AbstractReferringTestLanguageUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureHighlightingTokenDefProvider(Binder binder) {
	binder.bind(ITokenDefProvider.class)
		.annotatedWith(Names.named(LexerIdeBindings.HIGHLIGHTING))
		.to(AntlrTokenDefProvider.class);
}
 
Example #9
Source File: AbstractDatatypeRulesTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ITokenDefProvider> bindITokenDefProvider() {
	return AntlrTokenDefProvider.class;
}
 
Example #10
Source File: AbstractBug347012TestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ITokenDefProvider> bindITokenDefProvider() {
	return AntlrTokenDefProvider.class;
}
 
Example #11
Source File: AbstractInheritanceTest3LanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ITokenDefProvider> bindITokenDefProvider() {
	return AntlrTokenDefProvider.class;
}
 
Example #12
Source File: AbstractBug348199TestLanguageUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureHighlightingTokenDefProvider(Binder binder) {
	binder.bind(ITokenDefProvider.class)
		.annotatedWith(Names.named(LexerIdeBindings.HIGHLIGHTING))
		.to(AntlrTokenDefProvider.class);
}
 
Example #13
Source File: AbstractUnorderedGroupsTestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ITokenDefProvider> bindITokenDefProvider() {
	return AntlrTokenDefProvider.class;
}
 
Example #14
Source File: AbstractOutlineTestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ITokenDefProvider> bindITokenDefProvider() {
	return AntlrTokenDefProvider.class;
}
 
Example #15
Source File: AbstractTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ITokenDefProvider> bindITokenDefProvider() {
	return AntlrTokenDefProvider.class;
}
 
Example #16
Source File: AbstractComplexReconstrTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ITokenDefProvider> bindITokenDefProvider() {
	return AntlrTokenDefProvider.class;
}
 
Example #17
Source File: AbstractBacktrackingBug325745TestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ITokenDefProvider> bindITokenDefProvider() {
	return AntlrTokenDefProvider.class;
}
 
Example #18
Source File: AbstractEnumRulesUiTestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ITokenDefProvider> bindITokenDefProvider() {
	return AntlrTokenDefProvider.class;
}
 
Example #19
Source File: AbstractHiddenTerminalsTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ITokenDefProvider> bindITokenDefProvider() {
	return AntlrTokenDefProvider.class;
}
 
Example #20
Source File: AbstractRefactoringTestLanguage2UiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureHighlightingTokenDefProvider(Binder binder) {
	binder.bind(ITokenDefProvider.class)
		.annotatedWith(Names.named(LexerIdeBindings.HIGHLIGHTING))
		.to(AntlrTokenDefProvider.class);
}
 
Example #21
Source File: AbstractTestLanguageUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureHighlightingTokenDefProvider(Binder binder) {
	binder.bind(ITokenDefProvider.class)
		.annotatedWith(Names.named(LexerIdeBindings.HIGHLIGHTING))
		.to(AntlrTokenDefProvider.class);
}
 
Example #22
Source File: AbstractIndexTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ITokenDefProvider> bindITokenDefProvider() {
	return AntlrTokenDefProvider.class;
}
 
Example #23
Source File: AbstractContentAssistTestLanguageUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureHighlightingTokenDefProvider(Binder binder) {
	binder.bind(ITokenDefProvider.class)
		.annotatedWith(Names.named(LexerIdeBindings.HIGHLIGHTING))
		.to(AntlrTokenDefProvider.class);
}
 
Example #24
Source File: AbstractIgnoreCaseImportsTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ITokenDefProvider> bindITokenDefProvider() {
	return AntlrTokenDefProvider.class;
}
 
Example #25
Source File: AbstractTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ITokenDefProvider> bindITokenDefProvider() {
	return AntlrTokenDefProvider.class;
}
 
Example #26
Source File: AbstractSubTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ITokenDefProvider> bindITokenDefProvider() {
	return AntlrTokenDefProvider.class;
}
 
Example #27
Source File: AbstractParametersTestLanguageExRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ITokenDefProvider> bindITokenDefProvider() {
	return AntlrTokenDefProvider.class;
}
 
Example #28
Source File: AbstractNestedRefsTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ITokenDefProvider> bindITokenDefProvider() {
	return AntlrTokenDefProvider.class;
}
 
Example #29
Source File: AbstractSimpleBacktrackingBug325745TestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ITokenDefProvider> bindITokenDefProvider() {
	return AntlrTokenDefProvider.class;
}
 
Example #30
Source File: AbstractTwoContextsTestLanguageUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureHighlightingTokenDefProvider(Binder binder) {
	binder.bind(ITokenDefProvider.class)
		.annotatedWith(Names.named(LexerIdeBindings.HIGHLIGHTING))
		.to(AntlrTokenDefProvider.class);
}