internal static bool TryParseEnum <TEnum>(ParseResult result, AttributesHelper attributes, string attributeName, out TEnum answer, bool caseSensitive = true) where TEnum : struct
        {
            XAttribute attr = attributes.PopAttribute(attributeName, caseSensitive);

            // If it has the attribute
            if (attr != null)
            {
                // And the attribute has a value
                if (attr.Value != null)
                {
                    if (TryParseEnum(attr.Value, out answer))
                    {
                        return(true);
                    }

                    // Couldn't find matching enum
                    result.AddWarning($@"Unknown value ""{attr.Value}"" on {attributeName} attribute", GetErrorPositionInfo(attr));
                }

                // Attribute doesn't have a value
                else
                {
                    result.AddWarning($@"Attribute {attributeName} has no value specified", GetErrorPositionInfo(attr));
                }
            }

            // Attribute isn't found, no warning
            answer = default(TEnum);
            return(false);
        }
        internal static bool TryParse(ParseResult result, AttributesHelper attributes, string attributeName, out bool answer)
        {
            XAttribute attr = attributes.PopAttribute(attributeName);

            // If it has the attribute
            if (attr != null)
            {
                // And the attribute has a value
                if (attr.Value != null)
                {
                    // If it's a bool
                    if (bool.TryParse(attr.Value, out answer))
                    {
                        return(true);
                    }

                    // Otherwise warning about not being double
                    result.AddWarning($@"{attributeName} only accepts boolean values, not ""{attr.Value}""", GetErrorPositionInfo(attr));
                }

                // Attribute doesn't have a value
                else
                {
                    result.AddWarning($@"Attribute {attributeName} has no value specified", GetErrorPositionInfo(attr));
                }
            }

            // Attribute isn't found, no warning
            answer = default(bool);
            return(false);
        }
 internal static void AddWarningsForAttributesNotSupportedByVisualizer(ParseResult result, AttributesHelper attributes, params string[] attributeNames)
 {
     foreach (string attrName in attributeNames)
     {
         XAttribute a = attributes.PopAttribute(attrName);
         if (a != null)
         {
             result.AddWarning($@"The attribute ""{attrName}"" is a valid attribute, but the Visualizer does not support it.", GetErrorPositionInfo(a));
         }
     }
 }