/// <exception cref="BadSyntaxException"> /// The <paramref name="declaration"/> does not fit to the syntax. /// </exception> /// <exception cref="ReservedNameException"> /// The parameter name is already exists. /// </exception> public override Parameter Add(string declaration) { Match match = singleParamterRegex.Match(declaration); if (match.Success) { Group nameGroup = match.Groups["name"]; Group typeGroup = match.Groups["type"]; Group modifierGroup = match.Groups["modifier"]; Group defvalGroup = match.Groups["defval"]; if (IsReservedName(nameGroup.Value)) { throw new ReservedNameException(nameGroup.Value); } Parameter parameter = new CSharpParameter(nameGroup.Value, typeGroup.Value, ParseParameterModifier(modifierGroup.Value), defvalGroup.Value); InnerList.Add(parameter); return(parameter); } else { throw new BadSyntaxException(declaration + " - " + Strings.ErrorInvalidParameterDeclaration); } }
/// <exception cref="ReservedNameException"> /// The parameter name is already exists. /// </exception> public override Parameter Add(string name, string type, ParameterModifier modifier, string defaultValue) { if (IsReservedName(name)) { throw new ReservedNameException(name); } Parameter parameter = new CSharpParameter(name, type, modifier, defaultValue); InnerList.Add(parameter); return(parameter); }