Search in sources :

Example 16 with ParserRuleParameters

use of org.eclipse.xtext.parser.parameters.parametersTestLanguage.ParserRuleParameters in project xtext-core by eclipse.

the class NoParametersTestLanguageSemanticSequencer 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 == ParametersTestLanguagePackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case ParametersTestLanguagePackage.PARSER_RULE_PARAMETERS:
                sequence_ParserRuleParameters(context, (ParserRuleParameters) semanticObject);
                return;
            case ParametersTestLanguagePackage.SCENARIO:
                if (rule == grammarAccess.getScenario1Rule() && (parameters.isEmpty())) {
                    sequence_Scenario1$Param$false$(context, (Scenario) semanticObject);
                    return;
                } else if (rule == grammarAccess.getScenario1Rule() && (ImmutableSet.of(grammarAccess.getScenario1Rule().getParameters().get(0)).equals(parameters))) {
                    sequence_Scenario1$Param$true$(context, (Scenario) semanticObject);
                    return;
                } else if (rule == grammarAccess.getScenario1_FalseRule()) {
                    sequence_Scenario1_False(context, (Scenario) semanticObject);
                    return;
                } else if (rule == grammarAccess.getScenario1_TrueRule()) {
                    sequence_Scenario1_True(context, (Scenario) semanticObject);
                    return;
                } else if (rule == grammarAccess.getScenario2_FalseRule()) {
                    sequence_Scenario2_False(context, (Scenario) semanticObject);
                    return;
                } else if (rule == grammarAccess.getScenario2Rule()) {
                    sequence_Scenario2(context, (Scenario) semanticObject);
                    return;
                } else if (rule == grammarAccess.getScenario2_TrueRule()) {
                    sequence_Scenario2_True(context, (Scenario) semanticObject);
                    return;
                } else if (rule == grammarAccess.getScenario3_FalseRule()) {
                    sequence_Scenario3_False(context, (Scenario) semanticObject);
                    return;
                } else if (rule == grammarAccess.getScenario3Rule()) {
                    sequence_Scenario3(context, (Scenario) semanticObject);
                    return;
                } else if (rule == grammarAccess.getScenario3_TrueRule()) {
                    sequence_Scenario3_True(context, (Scenario) semanticObject);
                    return;
                } else if (rule == grammarAccess.getScenario4_FalseRule()) {
                    sequence_Scenario4_False(context, (Scenario) semanticObject);
                    return;
                } else if (rule == grammarAccess.getScenario4Rule()) {
                    sequence_Scenario4(context, (Scenario) semanticObject);
                    return;
                } else if (rule == grammarAccess.getScenario4_TrueRule()) {
                    sequence_Scenario4_True(context, (Scenario) semanticObject);
                    return;
                } else
                    break;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) Parameter(org.eclipse.xtext.Parameter) ParserRuleParameters(org.eclipse.xtext.parser.parameters.parametersTestLanguage.ParserRuleParameters) EPackage(org.eclipse.emf.ecore.EPackage) Scenario(org.eclipse.xtext.parser.parameters.parametersTestLanguage.Scenario)

Example 17 with ParserRuleParameters

use of org.eclipse.xtext.parser.parameters.parametersTestLanguage.ParserRuleParameters in project xtext-core by eclipse.

the class AbstractParametersParsingTest method testScenario8_keyword.

@Test
public void testScenario8_keyword() {
    try {
        final ParserRuleParameters instance = this.getModel("#8 keyword");
        Assert.assertEquals("keyword", instance.getScenario().getSecond());
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : ParserRuleParameters(org.eclipse.xtext.parser.parameters.parametersTestLanguage.ParserRuleParameters) Test(org.junit.Test)

Example 18 with ParserRuleParameters

use of org.eclipse.xtext.parser.parameters.parametersTestLanguage.ParserRuleParameters in project xtext-core by eclipse.

the class AbstractParametersParsingTest method testScenario9_keyword.

@Test
public void testScenario9_keyword() {
    try {
        final ParserRuleParameters instance = this.getModel("#9 keyword");
        Assert.assertEquals("keyword", instance.getScenario().getFirst());
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : ParserRuleParameters(org.eclipse.xtext.parser.parameters.parametersTestLanguage.ParserRuleParameters) Test(org.junit.Test)

Example 19 with ParserRuleParameters

use of org.eclipse.xtext.parser.parameters.parametersTestLanguage.ParserRuleParameters in project xtext-core by eclipse.

the class AbstractParametersParsingTest method testScenario8_id.

@Test
public void testScenario8_id() {
    try {
        final ParserRuleParameters instance = this.getModel("#8 id");
        Assert.assertEquals("id", instance.getScenario().getFirst());
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : ParserRuleParameters(org.eclipse.xtext.parser.parameters.parametersTestLanguage.ParserRuleParameters) Test(org.junit.Test)

Example 20 with ParserRuleParameters

use of org.eclipse.xtext.parser.parameters.parametersTestLanguage.ParserRuleParameters in project xtext-core by eclipse.

the class AbstractParametersParsingTest method testScenario2_second.

@Test
public void testScenario2_second() {
    try {
        final ParserRuleParameters instance = this.getModel("#2 second");
        Assert.assertEquals("second", instance.getScenario().getSecond());
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : ParserRuleParameters(org.eclipse.xtext.parser.parameters.parametersTestLanguage.ParserRuleParameters) Test(org.junit.Test)

Aggregations

ParserRuleParameters (org.eclipse.xtext.parser.parameters.parametersTestLanguage.ParserRuleParameters)28 Test (org.junit.Test)24 EPackage (org.eclipse.emf.ecore.EPackage)4 Action (org.eclipse.xtext.Action)4 Parameter (org.eclipse.xtext.Parameter)4 ParserRule (org.eclipse.xtext.ParserRule)4 Scenario (org.eclipse.xtext.parser.parameters.parametersTestLanguage.Scenario)4