static string GetDotNetTypeName(MSBuildValueKind kind)
        {
            if (kind.AllowLists())
            {
                return(null);
            }

            switch (kind)
            {
            case MSBuildValueKind.String:
                return("System.String");

            case MSBuildValueKind.Bool:
                return("System.Boolean");

            case MSBuildValueKind.Int:
                return("System.Int32");

            case MSBuildValueKind.Char:
                return("System.Char");

            case MSBuildValueKind.Float:
                return("System.Float");

            case MSBuildValueKind.Object:
                return("System.Object");

            case MSBuildValueKind.DateTime:
                return("System.DateTime");
            }

            return(null);
        }
        public static ExpressionOptions GetExpressionOptions(this MSBuildValueKind kind)
        {
            var options = ExpressionOptions.Items;

            if (kind.AllowLists())
            {
                options |= ExpressionOptions.Lists;
            }
            if (kind.AllowCommaLists())
            {
                options |= ExpressionOptions.CommaLists;
            }

            //FIXME: need more context to figure out whether to allow metadata. say yes for now.
            options |= ExpressionOptions.Metadata;

            return(options);
        }
Exemple #3
0
        //validates CommaValue and SemicolonValue, and collapses them to Value
        public static bool ValidateListPermitted(ListKind listKind, MSBuildValueKind kind)
        {
            switch (listKind)
            {
            case ListKind.Comma:
                if (kind.AllowCommaLists())
                {
                    return(true);
                }
                return(false);

            case ListKind.Semicolon:
                if (kind.AllowLists())
                {
                    return(true);
                }
                return(false);

            default:
                return(true);
            }
        }
        public static List <string> GetTypeDescription(this MSBuildValueKind kind)
        {
            var    modifierList = new List <string> ();
            string kindName     = FormatKind(kind);

            if (kindName != null)
            {
                modifierList.Add(kindName);
                if (kind.AllowLists())
                {
                    modifierList.Add("list");
                }
                else if (kind.AllowCommaLists())
                {
                    modifierList.Add("comma-list");
                }
                if (!kind.AllowExpressions())
                {
                    modifierList.Add("literal");
                }
            }

            return(modifierList);
        }
Exemple #5
0
        //validates CommaValue and SemicolonValue, and collapses them to Value
        public static bool ValidateListPermitted(ref TriggerState triggerState, MSBuildValueKind kind)
        {
            switch (triggerState)
            {
            case TriggerState.CommaValue:
                if (kind.AllowCommaLists())
                {
                    triggerState = TriggerState.Value;
                    return(true);
                }
                return(false);

            case TriggerState.SemicolonValue:
                if (kind.AllowLists())
                {
                    triggerState = TriggerState.Value;
                    return(true);
                }
                return(false);

            default:
                return(true);
            }
        }