Java Code Examples for org.eclipse.xtext.Grammar#getUsedGrammars()

The following examples show how to use org.eclipse.xtext.Grammar#getUsedGrammars() . 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: N4JSRenameStrategy.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Returns the TypeExpressions grammar
 */
protected Grammar getTypeExpressionsGrammar() {
	Grammar grammar = grammarProvider.getGrammar(this);
	while (grammar != null) {
		if ("org.eclipse.n4js.ts.TypeExpressions".equals(grammar.getName())) {
			return grammar;
		}
		List<Grammar> grammars = grammar.getUsedGrammars();
		if (!grammars.isEmpty()) {
			grammar = grammars.iterator().next();
		} else {
			return null;
		}
	}
	return grammar;
}
 
Example 2
Source File: XtextLinker.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected void updateOverriddenRules(Grammar grammar, Map<String, AbstractRule> rulePerName,
		Set<Grammar> visitedGrammars) {
	if (!visitedGrammars.add(grammar))
		return;
	updateOverriddenRules(grammar, rulePerName);
	for (Grammar usedGrammar : grammar.getUsedGrammars()) {
		updateOverriddenRules(usedGrammar, rulePerName, visitedGrammars);
	}
}
 
Example 3
Source File: TestLanguageGrammarAccess.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected Grammar internalFindGrammar(GrammarProvider grammarProvider) {
	Grammar grammar = grammarProvider.getGrammar(this);
	while (grammar != null) {
		if ("org.eclipse.xtext.ide.tests.testlanguage.TestLanguage".equals(grammar.getName())) {
			return grammar;
		}
		List<Grammar> grammars = grammar.getUsedGrammars();
		if (!grammars.isEmpty()) {
			grammar = grammars.iterator().next();
		} else {
			return null;
		}
	}
	return grammar;
}
 
Example 4
Source File: FragmentTestLanguageGrammarAccess.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected Grammar internalFindGrammar(GrammarProvider grammarProvider) {
	Grammar grammar = grammarProvider.getGrammar(this);
	while (grammar != null) {
		if ("org.eclipse.xtext.parser.fragments.FragmentTestLanguage".equals(grammar.getName())) {
			return grammar;
		}
		List<Grammar> grammars = grammar.getUsedGrammars();
		if (!grammars.isEmpty()) {
			grammar = grammars.iterator().next();
		} else {
			return null;
		}
	}
	return grammar;
}
 
Example 5
Source File: CodetemplatesGrammarAccess.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected Grammar internalFindGrammar(GrammarProvider grammarProvider) {
	Grammar grammar = grammarProvider.getGrammar(this);
	while (grammar != null) {
		if ("org.eclipse.xtext.ui.codetemplates.Codetemplates".equals(grammar.getName())) {
			return grammar;
		}
		List<Grammar> grammars = grammar.getUsedGrammars();
		if (!grammars.isEmpty()) {
			grammar = grammars.iterator().next();
		} else {
			return null;
		}
	}
	return grammar;
}
 
Example 6
Source File: XtextValidator.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
private Iterable<GeneratedMetamodel> getAllGeneratedMetamodels(Grammar grammar, Set<Grammar> visited) {
	Iterable<GeneratedMetamodel> result = Iterables.filter(grammar.getMetamodelDeclarations(),
			GeneratedMetamodel.class);
	for (Grammar gr : grammar.getUsedGrammars()) {
		if (visited.add(gr))
			result = Iterables.concat(result, getAllGeneratedMetamodels(gr, visited));
	}
	return result;
}
 
Example 7
Source File: IndentationAwareTestLanguageGrammarAccess.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected Grammar internalFindGrammar(GrammarProvider grammarProvider) {
	Grammar grammar = grammarProvider.getGrammar(this);
	while (grammar != null) {
		if ("org.eclipse.xtext.parser.indentation.IndentationAwareTestLanguage".equals(grammar.getName())) {
			return grammar;
		}
		List<Grammar> grammars = grammar.getUsedGrammars();
		if (!grammars.isEmpty()) {
			grammar = grammars.iterator().next();
		} else {
			return null;
		}
	}
	return grammar;
}
 
Example 8
Source File: RegionAccessTestLanguageGrammarAccess.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected Grammar internalFindGrammar(GrammarProvider grammarProvider) {
	Grammar grammar = grammarProvider.getGrammar(this);
	while (grammar != null) {
		if ("org.eclipse.xtext.formatting2.regionaccess.internal.RegionAccessTestLanguage".equals(grammar.getName())) {
			return grammar;
		}
		List<Grammar> grammars = grammar.getUsedGrammars();
		if (!grammars.isEmpty()) {
			grammar = grammars.iterator().next();
		} else {
			return null;
		}
	}
	return grammar;
}
 
Example 9
Source File: BuilderTestLanguageGrammarAccess.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected Grammar internalFindGrammar(GrammarProvider grammarProvider) {
	Grammar grammar = grammarProvider.getGrammar(this);
	while (grammar != null) {
		if ("org.eclipse.xtext.builder.tests.BuilderTestLanguage".equals(grammar.getName())) {
			return grammar;
		}
		List<Grammar> grammars = grammar.getUsedGrammars();
		if (!grammars.isEmpty()) {
			grammar = grammars.iterator().next();
		} else {
			return null;
		}
	}
	return grammar;
}
 
Example 10
Source File: ContentAssistTestLanguageGrammarAccess.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
protected Grammar internalFindGrammar(GrammarProvider grammarProvider) {
	Grammar grammar = grammarProvider.getGrammar(this);
	while (grammar != null) {
		if ("org.eclipse.xtext.common.types.xtext.ui.ContentAssistTestLanguage".equals(grammar.getName())) {
			return grammar;
		}
		List<Grammar> grammars = grammar.getUsedGrammars();
		if (!grammars.isEmpty()) {
			grammar = grammars.iterator().next();
		} else {
			return null;
		}
	}
	return grammar;
}
 
Example 11
Source File: Bug287184TestLanguageGrammarAccess.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected Grammar internalFindGrammar(GrammarProvider grammarProvider) {
	Grammar grammar = grammarProvider.getGrammar(this);
	while (grammar != null) {
		if ("org.eclipse.xtext.parser.assignments.Bug287184TestLanguage".equals(grammar.getName())) {
			return grammar;
		}
		List<Grammar> grammars = grammar.getUsedGrammars();
		if (!grammars.isEmpty()) {
			grammar = grammars.iterator().next();
		} else {
			return null;
		}
	}
	return grammar;
}
 
Example 12
Source File: ParametersTestLanguageExGrammarAccess.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected Grammar internalFindGrammar(GrammarProvider grammarProvider) {
	Grammar grammar = grammarProvider.getGrammar(this);
	while (grammar != null) {
		if ("org.eclipse.xtext.parser.parameters.ParametersTestLanguageEx".equals(grammar.getName())) {
			return grammar;
		}
		List<Grammar> grammars = grammar.getUsedGrammars();
		if (!grammars.isEmpty()) {
			grammar = grammars.iterator().next();
		} else {
			return null;
		}
	}
	return grammar;
}
 
Example 13
Source File: GrammarAccessTestLanguageGrammarAccess.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
protected Grammar internalFindGrammar(GrammarProvider grammarProvider) {
	Grammar grammar = grammarProvider.getGrammar(this);
	while (grammar != null) {
		if ("org.eclipse.xtext.generator.grammarAccess.GrammarAccessTestLanguage".equals(grammar.getName())) {
			return grammar;
		}
		List<Grammar> grammars = grammar.getUsedGrammars();
		if (!grammars.isEmpty()) {
			grammar = grammars.iterator().next();
		} else {
			return null;
		}
	}
	return grammar;
}
 
Example 14
Source File: AbstractIgnoreCaseLinkingTestLanguageGrammarAccess.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected Grammar internalFindGrammar(GrammarProvider grammarProvider) {
	Grammar grammar = grammarProvider.getGrammar(this);
	while (grammar != null) {
		if ("org.eclipse.xtext.linking.AbstractIgnoreCaseLinkingTestLanguage".equals(grammar.getName())) {
			return grammar;
		}
		List<Grammar> grammars = grammar.getUsedGrammars();
		if (!grammars.isEmpty()) {
			grammar = grammars.iterator().next();
		} else {
			return null;
		}
	}
	return grammar;
}
 
Example 15
Source File: ParameterizedExpressionsTestLanguageGrammarAccess.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected Grammar internalFindGrammar(GrammarProvider grammarProvider) {
	Grammar grammar = grammarProvider.getGrammar(this);
	while (grammar != null) {
		if ("org.eclipse.xtext.ui.tests.editor.contentassist.ParameterizedExpressionsTestLanguage".equals(grammar.getName())) {
			return grammar;
		}
		List<Grammar> grammars = grammar.getUsedGrammars();
		if (!grammars.isEmpty()) {
			grammar = grammars.iterator().next();
		} else {
			return null;
		}
	}
	return grammar;
}
 
Example 16
Source File: ContentAssistNoTerminalExtensionTestLanguageGrammarAccess.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected Grammar internalFindGrammar(GrammarProvider grammarProvider) {
	Grammar grammar = grammarProvider.getGrammar(this);
	while (grammar != null) {
		if ("org.eclipse.xtext.ui.tests.editor.contentassist.ContentAssistNoTerminalExtensionTestLanguage".equals(grammar.getName())) {
			return grammar;
		}
		List<Grammar> grammars = grammar.getUsedGrammars();
		if (!grammars.isEmpty()) {
			grammar = grammars.iterator().next();
		} else {
			return null;
		}
	}
	return grammar;
}
 
Example 17
Source File: SerializationErrorTestLanguageGrammarAccess.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected Grammar internalFindGrammar(GrammarProvider grammarProvider) {
	Grammar grammar = grammarProvider.getGrammar(this);
	while (grammar != null) {
		if ("org.eclipse.xtext.parsetree.reconstr.SerializationErrorTestLanguage".equals(grammar.getName())) {
			return grammar;
		}
		List<Grammar> grammars = grammar.getUsedGrammars();
		if (!grammars.isEmpty()) {
			grammar = grammars.iterator().next();
		} else {
			return null;
		}
	}
	return grammar;
}
 
Example 18
Source File: SimpleBacktrackingBug325745TestLanguageGrammarAccess.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected Grammar internalFindGrammar(GrammarProvider grammarProvider) {
	Grammar grammar = grammarProvider.getGrammar(this);
	while (grammar != null) {
		if ("org.eclipse.xtext.parser.unorderedGroups.SimpleBacktrackingBug325745TestLanguage".equals(grammar.getName())) {
			return grammar;
		}
		List<Grammar> grammars = grammar.getUsedGrammars();
		if (!grammars.isEmpty()) {
			grammar = grammars.iterator().next();
		} else {
			return null;
		}
	}
	return grammar;
}
 
Example 19
Source File: UnicodeTestLanguageGrammarAccess.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected Grammar internalFindGrammar(GrammarProvider grammarProvider) {
	Grammar grammar = grammarProvider.getGrammar(this);
	while (grammar != null) {
		if ("org.eclipse.xtext.parser.terminalrules.UnicodeTestLanguage".equals(grammar.getName())) {
			return grammar;
		}
		List<Grammar> grammars = grammar.getUsedGrammars();
		if (!grammars.isEmpty()) {
			grammar = grammars.iterator().next();
		} else {
			return null;
		}
	}
	return grammar;
}
 
Example 20
Source File: ContentAssistFragmentTestLangGrammarAccess.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
protected Grammar internalFindGrammar(GrammarProvider grammarProvider) {
	Grammar grammar = grammarProvider.getGrammar(this);
	while (grammar != null) {
		if ("org.eclipse.xtext.xbase.testlanguages.ContentAssistFragmentTestLang".equals(grammar.getName())) {
			return grammar;
		}
		List<Grammar> grammars = grammar.getUsedGrammars();
		if (!grammars.isEmpty()) {
			grammar = grammars.iterator().next();
		} else {
			return null;
		}
	}
	return grammar;
}