org.eclipse.xtext.xtext.generator.parser.antlr.ContentAssistGrammarNaming Java Examples

The following examples show how to use org.eclipse.xtext.xtext.generator.parser.antlr.ContentAssistGrammarNaming. 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: XtextAntlrGeneratorFragment2.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected void generateContentAssistGrammar() {
  @Extension
  final ContentAssistGrammarNaming naming = this.contentAssistNaming;
  final IXtextGeneratorFileSystemAccess fsa = this.getProjectConfig().getGenericIde().getSrcGen();
  this.contentAssistGenerator.generate(this.getGrammar(), this.getOptions(), fsa);
  this.runAntlr(naming.getParserGrammar(this.getGrammar()), naming.getLexerGrammar(this.getGrammar()), fsa);
  this.simplifyUnorderedGroupPredicatesIfRequired(this.getGrammar(), fsa, naming.getInternalParserClass(this.getGrammar()));
  this.splitParserAndLexerIfEnabled(fsa, naming.getInternalParserClass(this.getGrammar()), naming.getLexerClass(this.getGrammar()));
  this.normalizeTokens(fsa, naming.getLexerGrammar(this.getGrammar()).getTokensFileName());
  this.suppressWarnings(fsa, naming.getInternalParserClass(this.getGrammar()), naming.getLexerClass(this.getGrammar()));
  this.normalizeLineDelimiters(fsa, naming.getLexerClass(this.getGrammar()), naming.getInternalParserClass(this.getGrammar()));
  if (this.removeBacktrackingGuards) {
    this.removeBackTrackingGuards(fsa, naming.getInternalParserClass(this.getGrammar()), this.lookaheadThreshold);
  }
}
 
Example #2
Source File: XtextAntlrGeneratorComparisonFragment.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
public AntlrFragmentHelperEx(final Naming oldNaming, final GrammarNaming prodNaming, final ContentAssistGrammarNaming caNaming) {
  super(oldNaming);
  this.prodNaming = prodNaming;
  this.caNaming = caNaming;
}
 
Example #3
Source File: XtextAntlrGeneratorComparisonFragment.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
@Pure
protected ContentAssistGrammarNaming getContentAssistNaming() {
  return this.contentAssistNaming;
}
 
Example #4
Source File: XtextAntlrGeneratorFragment2.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
protected void addIdeBindingsAndImports() {
  @Extension
  final ContentAssistGrammarNaming naming = this.contentAssistNaming;
  ManifestAccess _manifest = this.getProjectConfig().getGenericIde().getManifest();
  boolean _tripleNotEquals = (_manifest != null);
  if (_tripleNotEquals) {
    ManifestAccess _manifest_1 = this.getProjectConfig().getGenericIde().getManifest();
    final Procedure1<ManifestAccess> _function = (ManifestAccess it) -> {
      Set<String> _exportedPackages = it.getExportedPackages();
      String _packageName = naming.getLexerClass(this.getGrammar()).getPackageName();
      String _packageName_1 = naming.getParserClass(this.getGrammar()).getPackageName();
      String _packageName_2 = naming.getInternalParserClass(this.getGrammar()).getPackageName();
      Iterables.<String>addAll(_exportedPackages, Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList(_packageName, _packageName_1, _packageName_2)));
      Set<String> _requiredBundles = it.getRequiredBundles();
      _requiredBundles.add("org.antlr.runtime;bundle-version=\"[3.2.0,3.2.1)\"");
    };
    ObjectExtensions.<ManifestAccess>operator_doubleArrow(_manifest_1, _function);
  }
  GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory();
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("binder.bind(");
      TypeReference _lexerSuperClass = naming.getLexerSuperClass(XtextAntlrGeneratorFragment2.this.getGrammar());
      _builder.append(_lexerSuperClass);
      _builder.append(".class)");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.append(".annotatedWith(");
      _builder.append(Names.class, "\t");
      _builder.append(".named(");
      TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ide.LexerIdeBindings");
      _builder.append(_typeRef, "\t");
      _builder.append(".CONTENT_ASSIST))");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.append(".to(");
      TypeReference _lexerClass = naming.getLexerClass(XtextAntlrGeneratorFragment2.this.getGrammar());
      _builder.append(_lexerClass, "\t");
      _builder.append(".class);");
      _builder.newLineIfNotEmpty();
    }
  };
  final GuiceModuleAccess.BindingFactory ideBindings = _bindingFactory.addConfiguredBinding("ContentAssistLexer", _client).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.antlr.IContentAssistParser"), naming.getParserClass(this.getGrammar())).addTypeToType(
    TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.IProposalConflictHelper"), 
    TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.antlr.AntlrProposalConflictHelper"));
  if (this.partialParsing) {
    ideBindings.addTypeToType(
      TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory"), 
      TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.antlr.PartialContentAssistContextFactory"));
  }
  boolean _hasSyntheticTerminalRule = this.hasSyntheticTerminalRule();
  if (_hasSyntheticTerminalRule) {
    ideBindings.addTypeToType(
      TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.CompletionPrefixProvider"), 
      TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.IndentationAwareCompletionPrefixProvider"));
  }
  ideBindings.contributeTo(this.getLanguage().getIdeGenModule());
}