예제 #1
0
        public static string ConvertQualifierValueInitializerAst(QualifierValueInitializerAst node, MofQuirks quirks = MofQuirks.None)
        {
            var source = new StringBuilder();

            // e.g.
            // Description("an instance of a class that derives from the GOLF_Base class. ")
            source.Append("(");
            source.Append(AstMofGenerator.ConvertLiteralValueAst(node.Value, quirks));
            source.Append(")");
            return(source.ToString());
        }
예제 #2
0
        public static string ConvertLiteralValueArrayAst(LiteralValueArrayAst node, MofQuirks quirks = MofQuirks.None)
        {
            var source = new StringBuilder();

            source.Append("{");
            source.Append(
                string.Join(
                    ", ",
                    node.Values.Select(v => AstMofGenerator.ConvertLiteralValueAst(v, quirks))
                    )
                );
            source.Append("}");
            return(source.ToString());
        }
예제 #3
0
        public static string ConvertPrimitiveTypeValueAst(PrimitiveTypeValueAst node, MofQuirks quirks = MofQuirks.None, string indent = "")
        {
            switch (node)
            {
            case LiteralValueAst ast:
                return(AstMofGenerator.ConvertLiteralValueAst(ast, quirks));

            case LiteralValueArrayAst ast:
                return(AstMofGenerator.ConvertLiteralValueArrayAst(ast, quirks));

            default:
                throw new NotImplementedException();
            }
        }
예제 #4
0
        public static string ConvertQualifierValueArrayInitializerAst(QualifierValueArrayInitializerAst node, MofQuirks quirks = MofQuirks.None)
        {
            var source = new StringBuilder();

            // e.g.
            // OCL{"-- the key property cannot be NULL", "inv: InstanceId.size() = 10"}
            source.Append("{");
            var index = 0;

            foreach (var value in node.Values)
            {
                if (index > 0)
                {
                    source.Append(", ");
                }
                source.Append(AstMofGenerator.ConvertLiteralValueAst(value, quirks));
                index++;
            }
            source.Append("}");
            return(source.ToString());
        }