internal static CssPrimitiveValue Create(Match match, bool readOnly)
{
if(match.Groups["length"].Success)
{
return new CssPrimitiveLengthValue(match.Groups["lengthNumber"].Value, match.Groups["lengthUnit"].Value, readOnly);
}
else if(match.Groups["angle"].Success)
{
return new CssPrimitiveAngleValue(match.Groups["angleNumber"].Value, match.Groups["angleUnit"].Value, readOnly);
}
else if(match.Groups["funcname"].Success && match.Groups["funcname"].Value == "rgb")
{
return new CssPrimitiveRgbValue(match.Groups["func"].Value, readOnly);
}
else if(match.Groups["colorIdent"].Success && CssPrimitiveRgbValue.IsColorName(match.Groups["colorIdent"].Value))
{
return new CssPrimitiveRgbValue(match.Groups["colorIdent"].Value, readOnly);
}
else
{
return new CssPrimitiveValue(match, readOnly);
}
}