use of org.eclipse.xtext.ParserRule in project xtext-core by eclipse.
the class UnassignedRuleCallTestLanguageSemanticSequencer method sequence.
@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
EPackage epackage = semanticObject.eClass().getEPackage();
ParserRule rule = context.getParserRule();
Action action = context.getAssignedAction();
Set<Parameter> parameters = context.getEnabledBooleanParameters();
if (epackage == UnassignedRuleCallTestLanguagePackage.eINSTANCE)
switch(semanticObject.eClass().getClassifierID()) {
case UnassignedRuleCallTestLanguagePackage.MODEL:
sequence_Model(context, (Model) semanticObject);
return;
case UnassignedRuleCallTestLanguagePackage.MODEL_FEATURES:
sequence_ModelFeatures(context, (ModelFeatures) semanticObject);
return;
}
if (errorAcceptor != null)
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
use of org.eclipse.xtext.ParserRule in project xtext-core by eclipse.
the class OverriddenValueInspectorTest method testUnorderedGroup_06.
@Test
public void testUnorderedGroup_06() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("grammar org.foo with org.eclipse.xtext.common.Terminals");
_builder.newLine();
_builder.append("generate metamodel \'foo.sample\'");
_builder.newLine();
_builder.append("Model : a = ID b = STRING & a = ID;");
_builder.newLine();
String grammarAsString = _builder.toString();
final Grammar grammar = this.getGrammar(grammarAsString);
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Model");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
}
use of org.eclipse.xtext.ParserRule in project xtext-core by eclipse.
the class OverriddenValueInspectorTest method testBug306281_08.
@Test
public void testBug306281_08() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("grammar org.foo with org.eclipse.xtext.common.Terminals");
_builder.newLine();
_builder.append("generate metamodel \'foo.sample\'");
_builder.newLine();
_builder.append("Model : name=ID (({Binary.left=current} operator = [Model] | {Binary.left=current} operator = [Model]) right=ID)+ name=ID;");
_builder.newLine();
String grammarAsString = _builder.toString();
final Grammar grammar = this.getGrammar(grammarAsString);
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Model");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
Assert.assertTrue(this.warnings.toString(), this.warnings.isEmpty());
}
use of org.eclipse.xtext.ParserRule in project xtext-core by eclipse.
the class OverriddenValueInspectorTest method testOptionalAction_04.
@Test
public void testOptionalAction_04() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("grammar org.foo with org.eclipse.xtext.common.Terminals");
_builder.newLine();
_builder.append("generate metamodel \'foo.sample\'");
_builder.newLine();
_builder.append("First : Second (isSecond=\'keyword\' | {First.second=current} id=INT) name=ID;");
_builder.newLine();
_builder.append("Second: \'keyword\' name=ID;");
_builder.newLine();
String grammarAsString = _builder.toString();
final Grammar grammar = this.getGrammar(grammarAsString);
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
}
use of org.eclipse.xtext.ParserRule in project xtext-core by eclipse.
the class OverriddenValueInspectorTest method testUnorderedGroup_02.
@Test
public void testUnorderedGroup_02() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("grammar org.foo with org.eclipse.xtext.common.Terminals");
_builder.newLine();
_builder.append("generate metamodel \'foo.sample\'");
_builder.newLine();
_builder.append("Model : \'x\' a = ID & \'y\' a = ID ;");
_builder.newLine();
String grammarAsString = _builder.toString();
final Grammar grammar = this.getGrammar(grammarAsString);
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Model");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
}
Aggregations