use of org.eclipse.xtext.xbase.lib.Functions.Function1 in project xtext-core by eclipse.
the class ContentAssistFragment2 method getFQFeatureNamesToExclude.
public Set<String> getFQFeatureNamesToExclude(final Grammar g) {
Set<String> _xifexpression = null;
Grammar _nonTerminalsSuperGrammar = GrammarUtil2.getNonTerminalsSuperGrammar(g);
boolean _tripleNotEquals = (_nonTerminalsSuperGrammar != null);
if (_tripleNotEquals) {
Sets.SetView<String> _xblockexpression = null;
{
final Set<String> thisGrammarFqFeatureNames = IterableExtensions.<String>toSet(this.computeFQFeatureNames(g));
final Function1<Grammar, Iterable<String>> _function = (Grammar it) -> {
return this.computeFQFeatureNames(it);
};
final Set<String> superGrammarsFqFeatureNames = IterableExtensions.<String>toSet(Iterables.<String>concat(ListExtensions.<Grammar, Iterable<String>>map(GrammarUtil.allUsedGrammars(g), _function)));
_xblockexpression = Sets.<String>intersection(thisGrammarFqFeatureNames, superGrammarsFqFeatureNames);
}
_xifexpression = _xblockexpression;
} else {
_xifexpression = CollectionLiterals.<String>emptySet();
}
return _xifexpression;
}
use of org.eclipse.xtext.xbase.lib.Functions.Function1 in project xtext-core by eclipse.
the class WizardConfigurationTest method inlinedTestProjectsAddTheirDependenciesToTheMainProject.
@Test
public void inlinedTestProjectsAddTheirDependenciesToTheMainProject() {
TestProjectDescriptor _testProject = this.config.getRuntimeProject().getTestProject();
_testProject.setEnabled(true);
this.config.setSourceLayout(SourceLayout.MAVEN);
final Consumer<ExternalDependency> _function = (ExternalDependency testDependency) -> {
final Function1<ExternalDependency, Boolean> _function_1 = (ExternalDependency it) -> {
return Boolean.valueOf(((Objects.equal(it.getMaven().getArtifactId(), testDependency.getMaven().getArtifactId()) && Objects.equal(it.getP2().getBundleId(), testDependency.getP2().getBundleId())) && Objects.equal(it.getP2().getPackages(), testDependency.getP2().getPackages())));
};
Assert.assertTrue(IterableExtensions.<ExternalDependency>exists(this.config.getRuntimeProject().getExternalDependencies(), _function_1));
};
this.config.getRuntimeProject().getTestProject().getExternalDependencies().forEach(_function);
}
use of org.eclipse.xtext.xbase.lib.Functions.Function1 in project xtext-core by eclipse.
the class Ecore2XtextExtensions method allConcreteRuleClassifiers.
public static Iterable<EClassifier> allConcreteRuleClassifiers(final Ecore2XtextConfiguration it) {
Iterable<EClassifier> _xifexpression = null;
EClass _rootElementClass = it.getRootElementClass();
boolean _tripleEquals = (_rootElementClass == null);
if (_tripleEquals) {
final Function1<EPackageInfo, Set<EClassifier>> _function = (EPackageInfo it_1) -> {
return Ecore2XtextExtensions.allReferencedClassifiers(it_1.getEPackage(), false);
};
final Function1<EClassifier, Boolean> _function_1 = (EClassifier it_1) -> {
return Boolean.valueOf(Ecore2XtextExtensions.needsConcreteRule(it_1));
};
_xifexpression = IterableExtensions.<EClassifier>filter(IterableExtensions.<EClassifier>toSet(Iterables.<EClassifier>concat(IterableExtensions.<EPackageInfo, Set<EClassifier>>map(it.getEPackageInfos(), _function))), _function_1);
} else {
Set<EClassifier> _xblockexpression = null;
{
final ArrayList<EClassifier> c = CollectionLiterals.<EClassifier>newArrayList(EClassifier.class.cast(it.getRootElementClass()));
Ecore2XtextExtensions.allAssignedClassifiers(it.getRootElementClass(), c);
final Function1<EClassifier, Boolean> _function_2 = (EClassifier cl) -> {
return Boolean.valueOf(Ecore2XtextExtensions.needsConcreteRule(cl));
};
_xblockexpression = IterableExtensions.<EClassifier>toSet(IterableExtensions.<EClassifier>filter(c, _function_2));
}
_xifexpression = _xblockexpression;
}
return _xifexpression;
}
use of org.eclipse.xtext.xbase.lib.Functions.Function1 in project xtext-core by eclipse.
the class Ecore2XtextExtensions method allDispatcherRuleClasses.
public static Collection<EClass> allDispatcherRuleClasses(final Ecore2XtextConfiguration it) {
Set<EClass> _xifexpression = null;
EClass _rootElementClass = it.getRootElementClass();
boolean _tripleEquals = (_rootElementClass == null);
if (_tripleEquals) {
final Function1<EPackageInfo, Set<EClassifier>> _function = (EPackageInfo it_1) -> {
return Ecore2XtextExtensions.allReferencedClassifiers(it_1.getEPackage(), false);
};
final Function1<EClassifier, Boolean> _function_1 = (EClassifier c) -> {
return Boolean.valueOf(Ecore2XtextExtensions.needsDispatcherRule(c));
};
_xifexpression = IterableExtensions.<EClass>toSet(Iterables.<EClass>filter(IterableExtensions.<EClassifier>filter(IterableExtensions.<EClassifier>toSet(Iterables.<EClassifier>concat(IterableExtensions.<EPackageInfo, Set<EClassifier>>map(it.getEPackageInfos(), _function))), _function_1), EClass.class));
} else {
final Function1<EClass, Iterable<EClassifier>> _function_2 = (EClass c) -> {
final Function1<EReference, Boolean> _function_3 = (EReference r) -> {
return Boolean.valueOf(Ecore2XtextExtensions.needsAssignment(r));
};
final Function1<EReference, EClassifier> _function_4 = (EReference it_1) -> {
return it_1.getEType();
};
return IterableExtensions.<EReference, EClassifier>map(IterableExtensions.<EReference>filter(c.getEAllReferences(), _function_3), _function_4);
};
_xifexpression = IterableExtensions.<EClass>toSet(Iterables.<EClass>filter(Iterables.<EClassifier>concat(IterableExtensions.<EClass, Iterable<EClassifier>>map(Iterables.<EClass>filter(Ecore2XtextExtensions.allConcreteRuleClassifiers(it), EClass.class), _function_2)), EClass.class));
}
return _xifexpression;
}
use of org.eclipse.xtext.xbase.lib.Functions.Function1 in project xtext-core by eclipse.
the class AntlrGrammarGenerator method compileParserImports.
@Override
protected String compileParserImports(final Grammar it, final AntlrOptions options) {
StringConcatenation _builder = new StringConcatenation();
_builder.newLine();
_builder.append("import org.eclipse.xtext.*;");
_builder.newLine();
_builder.append("import org.eclipse.xtext.parser.*;");
_builder.newLine();
_builder.append("import org.eclipse.xtext.parser.impl.*;");
_builder.newLine();
_builder.append("import org.eclipse.emf.ecore.util.EcoreUtil;");
_builder.newLine();
_builder.append("import org.eclipse.emf.ecore.EObject;");
_builder.newLine();
{
boolean _isEmpty = GrammarUtil.allEnumRules(it).isEmpty();
boolean _not = (!_isEmpty);
if (_not) {
_builder.append("import org.eclipse.emf.common.util.Enumerator;");
_builder.newLine();
}
}
_builder.append("import ");
String _name = this.getGrammarNaming().getInternalParserSuperClass(it).getName();
_builder.append(_name);
_builder.append(";");
_builder.newLineIfNotEmpty();
_builder.append("import org.eclipse.xtext.parser.antlr.XtextTokenStream;");
_builder.newLine();
_builder.append("import org.eclipse.xtext.parser.antlr.XtextTokenStream.HiddenTokens;");
_builder.newLine();
{
if (((!IterableExtensions.isEmpty(Iterables.<UnorderedGroup>filter(Iterables.<EObject>concat(ListExtensions.<ParserRule, List<EObject>>map(GrammarUtil.allParserRules(it), ((Function1<ParserRule, List<EObject>>) (ParserRule it_1) -> {
return EcoreUtil2.eAllContentsAsList(it_1);
}))), UnorderedGroup.class))) && options.isBacktrack())) {
_builder.append("import org.eclipse.xtext.parser.antlr.IUnorderedGroupHelper.UnorderedGroupState;");
_builder.newLine();
}
}
_builder.append("import org.eclipse.xtext.parser.antlr.AntlrDatatypeRuleToken;");
_builder.newLine();
_builder.append("import ");
String _name_1 = this._grammarAccessExtensions.getGrammarAccess(it).getName();
_builder.append(_name_1);
_builder.append(";");
_builder.newLineIfNotEmpty();
_builder.newLine();
return _builder.toString();
}
Aggregations