public override void InitFromString(string declaration)
{
Match match = eventRegex.Match(declaration);
RaiseChangedEvent = false;
try {
if (match.Success) {
ClearModifiers();
Group nameGroup = match.Groups["name"];
Group typeGroup = match.Groups["type"];
Group accessGroup = match.Groups["access"];
Group modifierGroup = match.Groups["modifier"];
Group nameDotGroup = match.Groups["namedot"];
if (CSharpLanguage.Instance.IsForbiddenName(nameGroup.Value))
throw new BadSyntaxException(Strings.ErrorInvalidName);
if (CSharpLanguage.Instance.IsForbiddenTypeName(typeGroup.Value))
throw new BadSyntaxException(Strings.ErrorInvalidTypeName);
ValidName = nameGroup.Value;
ValidType = typeGroup.Value;
IsExplicitImplementation = nameDotGroup.Success;
AccessModifier = Language.TryParseAccessModifier(accessGroup.Value);
foreach (Capture modifierCapture in modifierGroup.Captures) {
if (modifierCapture.Value == "static")
IsStatic = true;
if (modifierCapture.Value == "virtual")
IsVirtual = true;
if (modifierCapture.Value == "abstract")
IsAbstract = true;
if (modifierCapture.Value == "override")
IsOverride = true;
if (modifierCapture.Value == "sealed")
IsSealed = true;
if (modifierCapture.Value == "new")
IsHider = true;
}
}
else {
throw new BadSyntaxException(Strings.ErrorInvalidDeclaration);
}
}
finally {
RaiseChangedEvent = true;
}
}