/// <exception cref="BadSyntaxException"> /// The <paramref name="declaration" /> does not fit to the syntax. /// </exception> public override void InitFromString(string declaration) { var match = constructorRegex.Match(declaration); RaiseChangedEvent = false; try { if (match.Success) { ClearModifiers(); var nameGroup = match.Groups["name"]; var accessGroup = match.Groups["access"]; var staticGroup = match.Groups["static"]; var argsGroup = match.Groups["args"]; ValidName = nameGroup.Value; AccessModifier = Language.TryParseAccessModifier(accessGroup.Value); ArgumentList.InitFromString(argsGroup.Value); IsStatic = staticGroup.Success; } else { throw new BadSyntaxException(Strings.ErrorInvalidDeclaration); } } finally { RaiseChangedEvent = true; } }
/// <exception cref="BadSyntaxException"> /// The <paramref name="declaration"/> does not fit to the syntax. /// </exception> public override void InitFromString(string declaration) { Match match = constructorRegex.Match(declaration); RaiseChangedEvent = false; try { if (match.Success) { try { Group nameGroup = match.Groups["name"]; Group accessGroup = match.Groups["access"]; Group argsGroup = match.Groups["args"]; ValidName = nameGroup.Value; AccessModifier = Language.TryParseAccessModifier(accessGroup.Value); ArgumentList.InitFromString(argsGroup.Value); } catch (BadSyntaxException ex) { throw new BadSyntaxException( Strings.ErrorInvalidDeclaration, ex); } } else { throw new BadSyntaxException(Strings.ErrorInvalidDeclaration); } } finally { RaiseChangedEvent = true; } }
/// <exception cref="BadSyntaxException"> /// The <paramref name="declaration"/> does not fit to the syntax. /// </exception> 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; } }
/// <exception cref="BadSyntaxException"> /// The <paramref name="declaration"/> does not fit to the syntax. /// </exception> public override void InitFromString(string declaration) { Match match = propertyRegex.Match(declaration); RaisePreChangedEvent = RaiseChangedEvent = false; try { if (match.Success) { ClearModifiers(); ReadAccess = AccessModifier.Default; WriteAccess = AccessModifier.Default; 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"]; Group argsGroup = match.Groups["args"]; Group getGroup = match.Groups["get"]; Group setGroup = match.Groups["set"]; Group getAccessGroup = match.Groups["getaccess"]; Group setAccessGroup = match.Groups["setaccess"]; ArgumentList.InitFromString(argsGroup.Value); // Validating identifier's name if ((nameGroup.Value != "this" || !HasParameter) && CSharpLanguage.Instance.IsForbiddenName(nameGroup.Value)) { throw new BadSyntaxException(Strings.ErrorInvalidName); } else { ValidName = nameGroup.Value; } // Validating type's name if (CSharpLanguage.Instance.IsForbiddenTypeName(typeGroup.Value)) { throw new BadSyntaxException(Strings.ErrorInvalidTypeName); } else { ValidType = typeGroup.Value; } IsExplicitImplementation = nameDotGroup.Success; AccessModifier = Language.TryParseAccessModifier(accessGroup.Value); IsReadonly = getGroup.Success && !setGroup.Success; IsWriteonly = !getGroup.Success && setGroup.Success; ReadAccess = Language.TryParseAccessModifier(getAccessGroup.Value); WriteAccess = Language.TryParseAccessModifier(setAccessGroup.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 { RaisePreChangedEvent = RaiseChangedEvent = true; } }
/// <exception cref="BadSyntaxException"> /// The <paramref name="declaration"/> does not fit to the syntax. /// </exception> 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 staticGroup = match.Groups["static"]; Group operatorGroup = match.Groups["operator"]; Group convopGroup = match.Groups["convop"]; Group nameDotGroup = match.Groups["namedot"]; Group argsGroup = match.Groups["args"]; if (CSharpLanguage.Instance.IsForbiddenName(nameGroup.Value)) { throw new BadSyntaxException(Strings.GetString("error_invalid_name")); } if (CSharpLanguage.Instance.IsForbiddenTypeName(typeGroup.Value)) { throw new BadSyntaxException(Strings.GetString("error_invalid_type_name")); } ValidName = nameGroup.Value; ValidType = typeGroup.Value; isOperator = operatorGroup.Success; isConversionOperator = convopGroup.Success; if (IsOperator) { ClearModifiers(); IsStatic = true; AccessModifier = AccessModifier.Public; } else { AccessModifier = Language.TryParseAccessModifier(accessGroup.Value); } IsExplicitImplementation = nameDotGroup.Success; ArgumentList.InitFromString(argsGroup.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.GetString("error_invalid_declaration")); } } finally { RaiseChangedEvent = true; } }