use of org.eclipse.xtext.xtext.SuperCallScope in project xtext-core by eclipse.
the class SuperCallScopeTest method testGetElementsByEObject_03.
@Test
public void testGetElementsByEObject_03() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("grammar test.Lang with org.eclipse.xtext.common.Terminals");
_builder.newLine();
_builder.append("generate test \'http://test\'");
_builder.newLine();
_builder.append("Rule: name=ID;");
_builder.newLine();
_builder.append("terminal ID: super;");
_builder.newLine();
final String grammarAsString = _builder.toString();
EObject _model = this.getModel(grammarAsString);
final Grammar grammar = ((Grammar) _model);
AbstractRule _last = IterableExtensions.<AbstractRule>last(grammar.getRules());
final SuperCallScope scope = new SuperCallScope(_last);
final AbstractRule id = GrammarUtil.findRuleForName(grammar, "org.eclipse.xtext.common.Terminals.ID");
Iterable<IEObjectDescription> _elements = scope.getElements(id);
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "org.eclipse.xtext.common.Terminals.ID");
Pair<String, AbstractRule> _mappedTo = Pair.<String, AbstractRule>of("super", _findRuleForName);
AbstractRule _findRuleForName_1 = GrammarUtil.findRuleForName(grammar, "org.eclipse.xtext.common.Terminals.ID");
Pair<String, AbstractRule> _mappedTo_1 = Pair.<String, AbstractRule>of("super.ID", _findRuleForName_1);
AbstractRule _findRuleForName_2 = GrammarUtil.findRuleForName(grammar, "org.eclipse.xtext.common.Terminals.ID");
Pair<String, AbstractRule> _mappedTo_2 = Pair.<String, AbstractRule>of("Lang.ID", _findRuleForName_2);
AbstractRule _findRuleForName_3 = GrammarUtil.findRuleForName(grammar, "org.eclipse.xtext.common.Terminals.ID");
Pair<String, AbstractRule> _mappedTo_3 = Pair.<String, AbstractRule>of("test.Lang.ID", _findRuleForName_3);
this.assertElements(_elements, _mappedTo, _mappedTo_1, _mappedTo_2, _mappedTo_3);
}
use of org.eclipse.xtext.xtext.SuperCallScope in project xtext-core by eclipse.
the class SuperCallScopeTest method testGetElementsByName_06.
@Test
public void testGetElementsByName_06() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("grammar test.Lang with org.eclipse.xtext.common.Terminals");
_builder.newLine();
_builder.append("generate test \'http://test\'");
_builder.newLine();
_builder.append("Rule: name=ID;");
_builder.newLine();
_builder.append("terminal ID: super;");
_builder.newLine();
final String grammarAsString = _builder.toString();
EObject _model = this.getModel(grammarAsString);
final Grammar grammar = ((Grammar) _model);
final SuperCallScope scope = new SuperCallScope(grammar);
Iterable<IEObjectDescription> _elements = scope.getElements(QualifiedName.create("Lang", "ID"));
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "test.Lang.ID");
Pair<String, AbstractRule> _mappedTo = Pair.<String, AbstractRule>of("Lang.ID", _findRuleForName);
this.assertElements(_elements, _mappedTo);
}
Aggregations