private void getMethodParameters(string methodDeclaration) { if (!string.IsNullOrWhiteSpace(BaseMethodDefinition)) { methodDeclaration = methodDeclaration.Replace(BaseMethodDefinition, ""); } if (!string.IsNullOrWhiteSpace(_condensedGenericMethodTypeConditions)) { methodDeclaration = methodDeclaration.Replace(_condensedGenericMethodTypeConditions, ""); } var parameterBlock = ParenthesisBlock.InnerBlock(methodDeclaration); var inlineParameterBlock = parameterBlock.AsSingleLine(); if (string.IsNullOrEmpty(inlineParameterBlock)) { return; } var condensedParamBlock = GenericTypeBlock.SymboliseBlock(inlineParameterBlock, this); condensedParamBlock = AttributeBlock.SymboliseBlock(condensedParamBlock, this); foreach (var parameter in condensedParamBlock.Split(',')) { Parameters.Add(new DeclaredParameter(parameter.Trim(), this)); } }
private string getParameterType(string content) { var typePattern = @"^(?'Type'[\s\w\[\.\?\]]*)\s\w*"; var type = Regex.Match(content, typePattern).Groups["Type"].Value; if (string.IsNullOrWhiteSpace(type)) { throw new CodeParseException("Could not parse Parameter type"); } return(GenericTypeBlock.ExpandContent(type)); }
protected override string getMemberNameFromDeclaration(string fieldDeclaration) { var pattern = @"^(?'ReturnType'[\:\.\w\s\?]+)\s(?'MemberName'[\s\,\w]+)$"; var newDeclaration = GenericTypeBlock.SymboliseBlock(fieldDeclaration, this); var name = Regex.Match(newDeclaration, pattern).Groups["MemberName"].Value; if (string.IsNullOrWhiteSpace(name)) { throw new CodeParseException("Could not parse Field name"); } ReturnType = CodeUtils.ExpandAllSymbols(Regex.Match(newDeclaration, pattern).Groups["ReturnType"].Value, true); if (string.IsNullOrWhiteSpace(ReturnType)) { throw new CodeParseException("Could not parse Field return type"); } var fieldArray = name.Split(','); for (int i = 1; i < fieldArray.Count(); i++) { new FieldDefinition(fieldArray[i].Trim(), ReturnType, Content, Modifiers, Owner); } return(fieldArray[0]); }