public void TestInstructions()
        {
            List <StatementSyntax> result = CSharpParser.ParseInstructions(@"name = elName + ':' + classifierName; CreateDecompositionLink(structureId, parentSeDecomposition); BlockProperty2StructureElement(childEl, fmSeDecomposition, structureElements); ");

            foreach (StatementSyntax statementSyntax in result)
            {
                PrintNodeContent(statementSyntax);
            }
        }
        public void TestQvtKey()
        {
            List <StatementSyntax> result = CSharpParser.ParseInstructions(" Package(Name, Element.Stereotype); Element(Name); Other(One.Two.Three)");

            foreach (StatementSyntax statementSyntax in result)
            {
                PrintNodeContent(statementSyntax);
            }
        }
Beispiel #3
0
        private QVTBase.IPattern ConstructWhenOrWherePattern(QVTRelations.IRelation relation, string whenOrwhereCode)
        {
            QVTBase.Pattern result = new QVTBase.Pattern();

            List <StatementSyntax> instructions = CSharpParser.ParseInstructions(whenOrwhereCode);

            //TODO Filter ExpressionStatementSyntax is too restrictive, we must also create opaque expressions with eg. conditionnals
            foreach (ExpressionStatementSyntax expressionStatementSyntax in instructions.OfType <ExpressionStatementSyntax>())
            {
                ExpressionSyntax            expression    = expressionStatementSyntax.Expression;
                EssentialOCL.IOclExpression oclExpression = ConstructOCLExpression(relation, expression, result);
                QVTBase.IPredicate          predicate     = new QVTBase.Predicate()
                {
                    Pattern             = result,
                    ConditionExpression = oclExpression,
                };
                result.Predicate.Add(predicate);
            }

            return(result);
        }