Search in sources :

Example 1 with Model

use of org.eclipse.xtext.example.homeautomation.ruleEngine.Model in project xtext-eclipse by eclipse.

the class ModelTest method testParsing.

@Test
public void testParsing() throws Exception {
    String text = "Device Window can be open, closed\n" + "Device Heater can be on, off\n" + "Rule 'Save energy' when Window.open then\n" + "	fire(Heater.off)\n" + "	println('Another penny to the piggy bank!')\n";
    Model model = parseHelper.parse(text);
    Device device = (Device) model.getDeclarations().get(0);
    Assert.assertEquals("Window", device.getName());
    Rule rule = (Rule) model.getDeclarations().get(2);
    Assert.assertEquals("Save energy", rule.getDescription());
    Assert.assertEquals("open", rule.getDeviceState().getName());
}
Also used : Device(org.eclipse.xtext.example.homeautomation.ruleEngine.Device) Model(org.eclipse.xtext.example.homeautomation.ruleEngine.Model) Rule(org.eclipse.xtext.example.homeautomation.ruleEngine.Rule) Test(org.junit.Test)

Example 2 with Model

use of org.eclipse.xtext.example.homeautomation.ruleEngine.Model in project xtext-eclipse by eclipse.

the class RuleEngineParsingTest method loadModel.

@Test
public void loadModel() {
    try {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("Device Window can be open, closed");
        _builder.newLine();
        _builder.append(" ");
        _builder.newLine();
        _builder.append("Device Heater can be on, off, error");
        _builder.newLine();
        _builder.append(" ");
        _builder.newLine();
        _builder.append("Rule \'Save energy\' when Window.open then");
        _builder.newLine();
        _builder.append("    ");
        _builder.append("fire(Heater.off)");
        _builder.newLine();
        _builder.append("    ");
        _builder.append("println(\'Another penny to the piggy bank!\')");
        _builder.newLine();
        final Model result = this.parseHelper.parse(_builder);
        Assert.assertNotNull(result);
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Model(org.eclipse.xtext.example.homeautomation.ruleEngine.Model) Test(org.junit.Test)

Example 3 with Model

use of org.eclipse.xtext.example.homeautomation.ruleEngine.Model in project xtext-eclipse by eclipse.

the class SerializerTest method test.

@Test
public void test() throws Exception {
    Model model = ruleEngineFactory.createModel();
    XtextResourceSet rs = rsProvider.get();
    Device deviceWindows = createDevice("Window");
    model.getDeclarations().add(deviceWindows);
    State openState = createState("open");
    deviceWindows.getStates().add(openState);
    deviceWindows.getStates().add(createState("closed"));
    Device deviceHeater = createDevice("Heater");
    deviceHeater.getStates().add(createState("on"));
    deviceHeater.getStates().add(createState("off"));
    model.getDeclarations().add(deviceHeater);
    Rule rule = this.ruleEngineFactory.createRule();
    rule.setDescription("Save energy");
    rule.setDeviceState(openState);
    XBlockExpression block = xbaseFactory.createXBlockExpression();
    XVariableDeclaration var1 = xbaseFactory.createXVariableDeclaration();
    var1.setName("msg");
    XStringLiteral stringLiteral = this.xbaseFactory.createXStringLiteral();
    stringLiteral.setValue("Another penny to the piggy bank!");
    var1.setRight(stringLiteral);
    block.getExpressions().add(var1);
    XVariableDeclaration var2 = xbaseFactory.createXVariableDeclaration();
    var2.setName("x");
    XNumberLiteral numberLiteral = xbaseFactory.createXNumberLiteral();
    numberLiteral.setValue("1");
    var2.setRight(numberLiteral);
    block.getExpressions().add(var2);
    rule.setThenPart(block);
    model.getDeclarations().add(rule);
    Resource resource = rs.createResource(URI.createURI("heater." + fileExtensionProvider.getPrimaryFileExtension()));
    resource.getContents().add(model);
    StringWriter sw = new StringWriter();
    serializer.serialize(model, sw, SaveOptions.newBuilder().format().getOptions());
    String expectation = "Device Window can be open, closed\n" + "Device Heater can be on, off\n" + "Rule \"Save energy\" when Window.open then\n" + "	val msg = \"Another penny to the piggy bank!\"\n" + "	val x = 1\n";
    Assert.assertEquals(Strings.toPlatformLineSeparator(expectation), sw.toString());
}
Also used : XBlockExpression(org.eclipse.xtext.xbase.XBlockExpression) XVariableDeclaration(org.eclipse.xtext.xbase.XVariableDeclaration) XStringLiteral(org.eclipse.xtext.xbase.XStringLiteral) StringWriter(java.io.StringWriter) XtextResourceSet(org.eclipse.xtext.resource.XtextResourceSet) Device(org.eclipse.xtext.example.homeautomation.ruleEngine.Device) State(org.eclipse.xtext.example.homeautomation.ruleEngine.State) Model(org.eclipse.xtext.example.homeautomation.ruleEngine.Model) Resource(org.eclipse.emf.ecore.resource.Resource) Rule(org.eclipse.xtext.example.homeautomation.ruleEngine.Rule) XNumberLiteral(org.eclipse.xtext.xbase.XNumberLiteral) Test(org.junit.Test)

Example 4 with Model

use of org.eclipse.xtext.example.homeautomation.ruleEngine.Model in project xtext-eclipse by eclipse.

the class RuleEngineSemanticSequencer 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 == RuleEnginePackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case RuleEnginePackage.DEVICE:
                sequence_Device(context, (Device) semanticObject);
                return;
            case RuleEnginePackage.MODEL:
                sequence_Model(context, (Model) semanticObject);
                return;
            case RuleEnginePackage.RULE:
                sequence_Rule(context, (Rule) semanticObject);
                return;
            case RuleEnginePackage.STATE:
                sequence_State(context, (State) semanticObject);
                return;
        }
    else if (epackage == TypesPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case TypesPackage.JVM_FORMAL_PARAMETER:
                if (rule == grammarAccess.getFullJvmFormalParameterRule()) {
                    sequence_FullJvmFormalParameter(context, (JvmFormalParameter) semanticObject);
                    return;
                } else if (rule == grammarAccess.getJvmFormalParameterRule()) {
                    sequence_JvmFormalParameter(context, (JvmFormalParameter) semanticObject);
                    return;
                } else
                    break;
            case TypesPackage.JVM_GENERIC_ARRAY_TYPE_REFERENCE:
                sequence_JvmTypeReference(context, (JvmGenericArrayTypeReference) semanticObject);
                return;
            case TypesPackage.JVM_INNER_TYPE_REFERENCE:
                sequence_JvmParameterizedTypeReference(context, (JvmInnerTypeReference) semanticObject);
                return;
            case TypesPackage.JVM_LOWER_BOUND:
                if (rule == grammarAccess.getJvmLowerBoundAndedRule()) {
                    sequence_JvmLowerBoundAnded(context, (JvmLowerBound) semanticObject);
                    return;
                } else if (rule == grammarAccess.getJvmLowerBoundRule()) {
                    sequence_JvmLowerBound(context, (JvmLowerBound) semanticObject);
                    return;
                } else
                    break;
            case TypesPackage.JVM_PARAMETERIZED_TYPE_REFERENCE:
                if (action == grammarAccess.getJvmParameterizedTypeReferenceAccess().getJvmInnerTypeReferenceOuterAction_1_4_0_0_0()) {
                    sequence_JvmParameterizedTypeReference_JvmInnerTypeReference_1_4_0_0_0(context, (JvmParameterizedTypeReference) semanticObject);
                    return;
                } else if (rule == grammarAccess.getJvmTypeReferenceRule() || action == grammarAccess.getJvmTypeReferenceAccess().getJvmGenericArrayTypeReferenceComponentTypeAction_0_1_0_0() || rule == grammarAccess.getJvmParameterizedTypeReferenceRule() || rule == grammarAccess.getJvmArgumentTypeReferenceRule()) {
                    sequence_JvmParameterizedTypeReference(context, (JvmParameterizedTypeReference) semanticObject);
                    return;
                } else
                    break;
            case TypesPackage.JVM_TYPE_PARAMETER:
                sequence_JvmTypeParameter(context, (JvmTypeParameter) semanticObject);
                return;
            case TypesPackage.JVM_UPPER_BOUND:
                if (rule == grammarAccess.getJvmUpperBoundAndedRule()) {
                    sequence_JvmUpperBoundAnded(context, (JvmUpperBound) semanticObject);
                    return;
                } else if (rule == grammarAccess.getJvmUpperBoundRule()) {
                    sequence_JvmUpperBound(context, (JvmUpperBound) semanticObject);
                    return;
                } else
                    break;
            case TypesPackage.JVM_WILDCARD_TYPE_REFERENCE:
                sequence_JvmWildcardTypeReference(context, (JvmWildcardTypeReference) semanticObject);
                return;
        }
    else if (epackage == XbasePackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case XbasePackage.XASSIGNMENT:
                sequence_XAssignment_XMemberFeatureCall(context, (XAssignment) semanticObject);
                return;
            case XbasePackage.XBASIC_FOR_LOOP_EXPRESSION:
                sequence_XBasicForLoopExpression(context, (XBasicForLoopExpression) semanticObject);
                return;
            case XbasePackage.XBINARY_OPERATION:
                sequence_XAdditiveExpression_XAndExpression_XAssignment_XEqualityExpression_XMultiplicativeExpression_XOrExpression_XOtherOperatorExpression_XRelationalExpression(context, (XBinaryOperation) semanticObject);
                return;
            case XbasePackage.XBLOCK_EXPRESSION:
                if (rule == grammarAccess.getXBlockExpressionRule() || rule == grammarAccess.getXExpressionRule() || rule == grammarAccess.getXAssignmentRule() || action == grammarAccess.getXAssignmentAccess().getXBinaryOperationLeftOperandAction_1_1_0_0_0() || rule == grammarAccess.getXOrExpressionRule() || action == grammarAccess.getXOrExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXAndExpressionRule() || action == grammarAccess.getXAndExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXEqualityExpressionRule() || action == grammarAccess.getXEqualityExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXRelationalExpressionRule() || action == grammarAccess.getXRelationalExpressionAccess().getXInstanceOfExpressionExpressionAction_1_0_0_0_0() || action == grammarAccess.getXRelationalExpressionAccess().getXBinaryOperationLeftOperandAction_1_1_0_0_0() || rule == grammarAccess.getXOtherOperatorExpressionRule() || action == grammarAccess.getXOtherOperatorExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXAdditiveExpressionRule() || action == grammarAccess.getXAdditiveExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXMultiplicativeExpressionRule() || action == grammarAccess.getXMultiplicativeExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXUnaryOperationRule() || rule == grammarAccess.getXCastedExpressionRule() || action == grammarAccess.getXCastedExpressionAccess().getXCastedExpressionTargetAction_1_0_0_0() || rule == grammarAccess.getXPostfixOperationRule() || action == grammarAccess.getXPostfixOperationAccess().getXPostfixOperationOperandAction_1_0_0() || rule == grammarAccess.getXMemberFeatureCallRule() || action == grammarAccess.getXMemberFeatureCallAccess().getXAssignmentAssignableAction_1_0_0_0_0() || action == grammarAccess.getXMemberFeatureCallAccess().getXMemberFeatureCallMemberCallTargetAction_1_1_0_0_0() || rule == grammarAccess.getXPrimaryExpressionRule() || rule == grammarAccess.getXParenthesizedExpressionRule() || rule == grammarAccess.getXExpressionOrVarDeclarationRule()) {
                    sequence_XBlockExpression(context, (XBlockExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getXExpressionInClosureRule()) {
                    sequence_XExpressionInClosure(context, (XBlockExpression) semanticObject);
                    return;
                } else
                    break;
            case XbasePackage.XBOOLEAN_LITERAL:
                sequence_XBooleanLiteral(context, (XBooleanLiteral) semanticObject);
                return;
            case XbasePackage.XCASE_PART:
                sequence_XCasePart(context, (XCasePart) semanticObject);
                return;
            case XbasePackage.XCASTED_EXPRESSION:
                sequence_XCastedExpression(context, (XCastedExpression) semanticObject);
                return;
            case XbasePackage.XCATCH_CLAUSE:
                sequence_XCatchClause(context, (XCatchClause) semanticObject);
                return;
            case XbasePackage.XCLOSURE:
                if (rule == grammarAccess.getXExpressionRule() || rule == grammarAccess.getXAssignmentRule() || action == grammarAccess.getXAssignmentAccess().getXBinaryOperationLeftOperandAction_1_1_0_0_0() || rule == grammarAccess.getXOrExpressionRule() || action == grammarAccess.getXOrExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXAndExpressionRule() || action == grammarAccess.getXAndExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXEqualityExpressionRule() || action == grammarAccess.getXEqualityExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXRelationalExpressionRule() || action == grammarAccess.getXRelationalExpressionAccess().getXInstanceOfExpressionExpressionAction_1_0_0_0_0() || action == grammarAccess.getXRelationalExpressionAccess().getXBinaryOperationLeftOperandAction_1_1_0_0_0() || rule == grammarAccess.getXOtherOperatorExpressionRule() || action == grammarAccess.getXOtherOperatorExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXAdditiveExpressionRule() || action == grammarAccess.getXAdditiveExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXMultiplicativeExpressionRule() || action == grammarAccess.getXMultiplicativeExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXUnaryOperationRule() || rule == grammarAccess.getXCastedExpressionRule() || action == grammarAccess.getXCastedExpressionAccess().getXCastedExpressionTargetAction_1_0_0_0() || rule == grammarAccess.getXPostfixOperationRule() || action == grammarAccess.getXPostfixOperationAccess().getXPostfixOperationOperandAction_1_0_0() || rule == grammarAccess.getXMemberFeatureCallRule() || action == grammarAccess.getXMemberFeatureCallAccess().getXAssignmentAssignableAction_1_0_0_0_0() || action == grammarAccess.getXMemberFeatureCallAccess().getXMemberFeatureCallMemberCallTargetAction_1_1_0_0_0() || rule == grammarAccess.getXPrimaryExpressionRule() || rule == grammarAccess.getXLiteralRule() || rule == grammarAccess.getXClosureRule() || rule == grammarAccess.getXParenthesizedExpressionRule() || rule == grammarAccess.getXExpressionOrVarDeclarationRule()) {
                    sequence_XClosure(context, (XClosure) semanticObject);
                    return;
                } else if (rule == grammarAccess.getXShortClosureRule()) {
                    sequence_XShortClosure(context, (XClosure) semanticObject);
                    return;
                } else
                    break;
            case XbasePackage.XCONSTRUCTOR_CALL:
                sequence_XConstructorCall(context, (XConstructorCall) semanticObject);
                return;
            case XbasePackage.XDO_WHILE_EXPRESSION:
                sequence_XDoWhileExpression(context, (XDoWhileExpression) semanticObject);
                return;
            case XbasePackage.XFEATURE_CALL:
                sequence_XFeatureCall(context, (XFeatureCall) semanticObject);
                return;
            case XbasePackage.XFOR_LOOP_EXPRESSION:
                sequence_XForLoopExpression(context, (XForLoopExpression) semanticObject);
                return;
            case XbasePackage.XIF_EXPRESSION:
                sequence_XIfExpression(context, (XIfExpression) semanticObject);
                return;
            case XbasePackage.XINSTANCE_OF_EXPRESSION:
                sequence_XRelationalExpression(context, (XInstanceOfExpression) semanticObject);
                return;
            case XbasePackage.XLIST_LITERAL:
                sequence_XListLiteral(context, (XListLiteral) semanticObject);
                return;
            case XbasePackage.XMEMBER_FEATURE_CALL:
                sequence_XMemberFeatureCall(context, (XMemberFeatureCall) semanticObject);
                return;
            case XbasePackage.XNULL_LITERAL:
                sequence_XNullLiteral(context, (XNullLiteral) semanticObject);
                return;
            case XbasePackage.XNUMBER_LITERAL:
                sequence_XNumberLiteral(context, (XNumberLiteral) semanticObject);
                return;
            case XbasePackage.XPOSTFIX_OPERATION:
                sequence_XPostfixOperation(context, (XPostfixOperation) semanticObject);
                return;
            case XbasePackage.XRETURN_EXPRESSION:
                sequence_XReturnExpression(context, (XReturnExpression) semanticObject);
                return;
            case XbasePackage.XSET_LITERAL:
                sequence_XSetLiteral(context, (XSetLiteral) semanticObject);
                return;
            case XbasePackage.XSTRING_LITERAL:
                sequence_XStringLiteral(context, (XStringLiteral) semanticObject);
                return;
            case XbasePackage.XSWITCH_EXPRESSION:
                sequence_XSwitchExpression(context, (XSwitchExpression) semanticObject);
                return;
            case XbasePackage.XSYNCHRONIZED_EXPRESSION:
                sequence_XSynchronizedExpression(context, (XSynchronizedExpression) semanticObject);
                return;
            case XbasePackage.XTHROW_EXPRESSION:
                sequence_XThrowExpression(context, (XThrowExpression) semanticObject);
                return;
            case XbasePackage.XTRY_CATCH_FINALLY_EXPRESSION:
                sequence_XTryCatchFinallyExpression(context, (XTryCatchFinallyExpression) semanticObject);
                return;
            case XbasePackage.XTYPE_LITERAL:
                sequence_XTypeLiteral(context, (XTypeLiteral) semanticObject);
                return;
            case XbasePackage.XUNARY_OPERATION:
                sequence_XUnaryOperation(context, (XUnaryOperation) semanticObject);
                return;
            case XbasePackage.XVARIABLE_DECLARATION:
                sequence_XVariableDeclaration(context, (XVariableDeclaration) semanticObject);
                return;
            case XbasePackage.XWHILE_EXPRESSION:
                sequence_XWhileExpression(context, (XWhileExpression) semanticObject);
                return;
        }
    else if (epackage == XtypePackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case XtypePackage.XFUNCTION_TYPE_REF:
                sequence_XFunctionTypeRef(context, (XFunctionTypeRef) semanticObject);
                return;
            case XtypePackage.XIMPORT_DECLARATION:
                sequence_XImportDeclaration(context, (XImportDeclaration) semanticObject);
                return;
            case XtypePackage.XIMPORT_SECTION:
                sequence_XImportSection(context, (XImportSection) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : XCatchClause(org.eclipse.xtext.xbase.XCatchClause) XDoWhileExpression(org.eclipse.xtext.xbase.XDoWhileExpression) ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) XBasicForLoopExpression(org.eclipse.xtext.xbase.XBasicForLoopExpression) XClosure(org.eclipse.xtext.xbase.XClosure) XFeatureCall(org.eclipse.xtext.xbase.XFeatureCall) XPostfixOperation(org.eclipse.xtext.xbase.XPostfixOperation) XSwitchExpression(org.eclipse.xtext.xbase.XSwitchExpression) XBinaryOperation(org.eclipse.xtext.xbase.XBinaryOperation) XListLiteral(org.eclipse.xtext.xbase.XListLiteral) EPackage(org.eclipse.emf.ecore.EPackage) XInstanceOfExpression(org.eclipse.xtext.xbase.XInstanceOfExpression) XIfExpression(org.eclipse.xtext.xbase.XIfExpression) XMemberFeatureCall(org.eclipse.xtext.xbase.XMemberFeatureCall) XCasePart(org.eclipse.xtext.xbase.XCasePart) XForLoopExpression(org.eclipse.xtext.xbase.XForLoopExpression) XNumberLiteral(org.eclipse.xtext.xbase.XNumberLiteral) XReturnExpression(org.eclipse.xtext.xbase.XReturnExpression) XAssignment(org.eclipse.xtext.xbase.XAssignment) XThrowExpression(org.eclipse.xtext.xbase.XThrowExpression) XBlockExpression(org.eclipse.xtext.xbase.XBlockExpression) XCastedExpression(org.eclipse.xtext.xbase.XCastedExpression) XVariableDeclaration(org.eclipse.xtext.xbase.XVariableDeclaration) XStringLiteral(org.eclipse.xtext.xbase.XStringLiteral) JvmLowerBound(org.eclipse.xtext.common.types.JvmLowerBound) Device(org.eclipse.xtext.example.homeautomation.ruleEngine.Device) XSetLiteral(org.eclipse.xtext.xbase.XSetLiteral) XConstructorCall(org.eclipse.xtext.xbase.XConstructorCall) XTypeLiteral(org.eclipse.xtext.xbase.XTypeLiteral) JvmUpperBound(org.eclipse.xtext.common.types.JvmUpperBound) XSynchronizedExpression(org.eclipse.xtext.xbase.XSynchronizedExpression) XBooleanLiteral(org.eclipse.xtext.xbase.XBooleanLiteral) JvmFormalParameter(org.eclipse.xtext.common.types.JvmFormalParameter) State(org.eclipse.xtext.example.homeautomation.ruleEngine.State) XNullLiteral(org.eclipse.xtext.xbase.XNullLiteral) XUnaryOperation(org.eclipse.xtext.xbase.XUnaryOperation) XWhileExpression(org.eclipse.xtext.xbase.XWhileExpression) Model(org.eclipse.xtext.example.homeautomation.ruleEngine.Model) JvmFormalParameter(org.eclipse.xtext.common.types.JvmFormalParameter) JvmTypeParameter(org.eclipse.xtext.common.types.JvmTypeParameter) Parameter(org.eclipse.xtext.Parameter) ParserRule(org.eclipse.xtext.ParserRule) Rule(org.eclipse.xtext.example.homeautomation.ruleEngine.Rule) XTryCatchFinallyExpression(org.eclipse.xtext.xbase.XTryCatchFinallyExpression) JvmParameterizedTypeReference(org.eclipse.xtext.common.types.JvmParameterizedTypeReference)

Example 5 with Model

use of org.eclipse.xtext.example.homeautomation.ruleEngine.Model in project xtext-eclipse by eclipse.

the class RuleEngineFormatter method _format.

protected void _format(final Model model, @Extension final IFormattableDocument document) {
    final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> {
        it.setNewLines(0, 0, 1);
        it.noSpace();
    };
    document.<Model>prepend(model, _function);
    EList<Declaration> _declarations = model.getDeclarations();
    for (final Declaration declaration : _declarations) {
        final Procedure1<IHiddenRegionFormatter> _function_1 = (IHiddenRegionFormatter it) -> {
            it.setNewLines(1, 1, 2);
        };
        document.<Declaration>append(document.<Declaration>format(declaration), _function_1);
    }
}
Also used : IHiddenRegionFormatter(org.eclipse.xtext.formatting2.IHiddenRegionFormatter) Model(org.eclipse.xtext.example.homeautomation.ruleEngine.Model) Declaration(org.eclipse.xtext.example.homeautomation.ruleEngine.Declaration) XVariableDeclaration(org.eclipse.xtext.xbase.XVariableDeclaration) XImportDeclaration(org.eclipse.xtext.xtype.XImportDeclaration)

Aggregations

Model (org.eclipse.xtext.example.homeautomation.ruleEngine.Model)5 Device (org.eclipse.xtext.example.homeautomation.ruleEngine.Device)3 Rule (org.eclipse.xtext.example.homeautomation.ruleEngine.Rule)3 XVariableDeclaration (org.eclipse.xtext.xbase.XVariableDeclaration)3 Test (org.junit.Test)3 State (org.eclipse.xtext.example.homeautomation.ruleEngine.State)2 XBlockExpression (org.eclipse.xtext.xbase.XBlockExpression)2 XNumberLiteral (org.eclipse.xtext.xbase.XNumberLiteral)2 XStringLiteral (org.eclipse.xtext.xbase.XStringLiteral)2 StringWriter (java.io.StringWriter)1 EPackage (org.eclipse.emf.ecore.EPackage)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)1 Action (org.eclipse.xtext.Action)1 Parameter (org.eclipse.xtext.Parameter)1 ParserRule (org.eclipse.xtext.ParserRule)1 JvmFormalParameter (org.eclipse.xtext.common.types.JvmFormalParameter)1 JvmLowerBound (org.eclipse.xtext.common.types.JvmLowerBound)1 JvmParameterizedTypeReference (org.eclipse.xtext.common.types.JvmParameterizedTypeReference)1 JvmTypeParameter (org.eclipse.xtext.common.types.JvmTypeParameter)1