コード例 #1
0
        public static string ConvertMofProductionAst(MofProductionAst node, MofQuirks quirks = MofQuirks.None)
        {
            switch (node)
            {
            case CompilerDirectiveAst ast:
                return(AstMofGenerator.ConvertCompilerDirectiveAst(ast, quirks));

            case StructureDeclarationAst ast:
                return(AstMofGenerator.ConvertStructureDeclarationAst(ast, quirks));

            case ClassDeclarationAst ast:
                return(AstMofGenerator.ConvertClassDeclarationAst(ast, quirks));

            case AssociationDeclarationAst ast:
                return(AstMofGenerator.ConvertAssociationDeclarationAst(ast, quirks));

            case EnumerationDeclarationAst ast:
                return(AstMofGenerator.ConvertEnumerationDeclarationAst(ast, quirks));

            case InstanceValueDeclarationAst ast:
                return(AstMofGenerator.ConvertInstanceValueDeclarationAst(ast, quirks));

            case StructureValueDeclarationAst ast:
                return(AstMofGenerator.ConvertStructureValueDeclarationAst(ast, quirks));

            case QualifierTypeDeclarationAst ast:
                return(AstMofGenerator.ConvertQualifierTypeDeclarationAst(ast, quirks));

            default:
                throw new NotImplementedException();
            }
        }
コード例 #2
0
        public static string ConvertToMof(AstNode node, MofQuirks quirks = MofQuirks.None)
        {
            if (node == null)
            {
                return(null);
            }
            switch (node)
            {
            case MofSpecificationAst ast:
                // 7.2 MOF specification
                return(AstMofGenerator.ConvertMofSpecificationAst(ast, quirks));

            case CompilerDirectiveAst ast:
                // 7.3 Compiler directives
                return(AstMofGenerator.ConvertCompilerDirectiveAst(ast, quirks));

            case QualifierTypeDeclarationAst ast:
                // 7.4 Qualifiers
                return(AstMofGenerator.ConvertQualifierTypeDeclarationAst(ast, quirks));

            case QualifierListAst ast:
                // 7.4.1 QualifierList
                return(AstMofGenerator.ConvertQualifierListAst(ast, quirks));

            case ClassDeclarationAst ast:
                // 7.5.2 Class declaration
                return(AstMofGenerator.ConvertClassDeclarationAst(ast, quirks));

            case PropertyDeclarationAst ast:
                // 7.5.5 Property declaration
                return(AstMofGenerator.ConvertPropertyDeclarationAst(ast, quirks));

            case MethodDeclarationAst ast:
                // 7.5.6 Method declaration
                return(AstMofGenerator.ConvertMethodDeclarationAst(ast, quirks));

            case ParameterDeclarationAst ast:
                // 7.5.7 Parameter declaration
                return(AstMofGenerator.ConvertParameterDeclarationAst(ast, quirks));

            case ComplexValueArrayAst ast:
                // 7.5.9 Complex type value
                return(AstMofGenerator.ConvertComplexValueArrayAst(ast, quirks));

            case ComplexValueAst ast:
                // 7.5.9 Complex type value
                return(AstMofGenerator.ConvertComplexValueAst(ast, quirks));

            case PropertyValueListAst ast:
                // 7.5.9 Complex type value
                return(AstMofGenerator.ConvertPropertyValueListAst(ast, quirks));

            case LiteralValueArrayAst ast:
                // 7.6.1 Primitive type value
                return(AstMofGenerator.ConvertLiteralValueArrayAst(ast, quirks));

            case IntegerValueAst ast:
                // 7.6.1.1 Integer value
                return(AstMofGenerator.ConvertIntegerValueAst(ast, quirks));

            case RealValueAst ast:
                // 7.6.1.2 Real value
                return(AstMofGenerator.ConvertRealValueAst(ast, quirks));

            case StringValueAst ast:
                // 7.6.1.3 String values
                return(AstMofGenerator.ConvertStringValueAst(ast, quirks));

            case BooleanValueAst ast:
                // 7.6.1.5 Boolean value
                return(AstMofGenerator.ConvertBooleanValueAst(ast, quirks));

            case NullValueAst ast:
                // 7.6.1.6 Null value
                return(AstMofGenerator.ConvertNullValueAst(ast, quirks));

            case InstanceValueDeclarationAst ast:
                // 7.6.2 Complex type value
                return(AstMofGenerator.ConvertInstanceValueDeclarationAst(ast, quirks));

            case StructureValueDeclarationAst ast:
                // 7.6.2 Complex type value
                return(AstMofGenerator.ConvertStructureValueDeclarationAst(ast, quirks));

            case EnumValueAst ast:
                // 7.6.3 Enum type value
                return(AstMofGenerator.ConvertEnumValueAst(ast, quirks));

            case EnumValueArrayAst ast:
                // 7.6.3 Enum type value
                return(AstMofGenerator.ConvertEnumValueArrayAst(ast, quirks));

            case EnumTypeValueAst ast:
                // 7.6.3 Enum type value
                return(AstMofGenerator.ConvertEnumTypeValueAst(ast, quirks));

            case PropertyValueAst ast:
                // 7.5.9 Complex type value
                return(AstMofGenerator.ConvertPropertyValueAst(ast, quirks));

            default:
                // unknown
                throw new InvalidOperationException(node.GetType().FullName);
            }
        }