public override void InitFromString(string declaration)
{
Match match = methodRegex.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 argsGroup = match.Groups["args"];
if (JavaLanguage.Instance.IsForbiddenName(nameGroup.Value))
throw new BadSyntaxException(Strings.ErrorInvalidName);
if (JavaLanguage.Instance.IsForbiddenTypeName(typeGroup.Value))
throw new BadSyntaxException(Strings.ErrorInvalidTypeName);
ValidName = nameGroup.Value;
ValidType = typeGroup.Value;
ArgumentList.InitFromString(argsGroup.Value);
AccessModifier = Language.TryParseAccessModifier(accessGroup.Value);
foreach (Capture modifierCapture in modifierGroup.Captures) {
if (modifierCapture.Value == "static")
IsStatic = true;
if (modifierCapture.Value == "abstract")
IsAbstract = true;
if (modifierCapture.Value == "final")
IsSealed = true;
}
}
else {
throw new BadSyntaxException(Strings.ErrorInvalidDeclaration);
}
}
finally {
RaiseChangedEvent = true;
}
}