private void getAttributeParametersFromContent(string attributeContent) { foreach (var parameter in attributeContent.Split(',')) { var fullParameterContent = CodeUtils.ExpandAllSymbols(parameter); Parameters.Add(fullParameterContent); } }
private void init(string name, string content, List <string> modifiers, IStaticCodeElement owner) { Owner = owner; Name = CodeUtils.ExpandAllSymbols(name); Elements = new List <IStaticCodeElement>(); Modifiers = modifiers; _condensedContent = content; Content = CodeUtils.ExpandAllSymbols(content, true); owner.Elements.Add(this); }
public TypeDefinition(string typeDeclaration, string typeContents, IStaticCodeElement owner) { Modifiers = parseTypeModifiers(ref typeDeclaration); Name = getTypeNameFromDeclaration(typeDeclaration); Content = CodeUtils.ExpandAllSymbols(typeContents); Owner = owner; Elements = new List <IStaticCodeElement>(); owner.Elements.Add(this); LineCount = GetLineCount(typeContents); }
public DeclaredParameter(string content, IStaticCodeElement owner) { Content = CodeUtils.ExpandAllSymbols(content, true); Owner = owner; Elements = new List <IStaticCodeElement>(); Attributes = new List <DeclaredAttribute>(); getParameterAttributes(ref content); _condensedDefaultValue = getDefaultValue(ref content); Name = getParameterName(content); ParameterType = getParameterType(content); }
protected override string getMemberNameFromDeclaration(string methodDeclaration) { var inlineMethodDeclaration = methodDeclaration.AsSingleLine(); var constructorPattern = @"^(?'MemberName'\w+)\s*__PARENTHESIS__[0-9]+__(?'SuperConstructor'$|\s*\:\s*(this|base)\s*__PARENTHESIS__[0-9]+__$)"; var constructorName = Regex.Match(inlineMethodDeclaration, constructorPattern).Groups["MemberName"].Value; if (!string.IsNullOrWhiteSpace(constructorName)) { MethodType = DefinedMethodType.Constructor; if (!string.IsNullOrWhiteSpace(Regex.Match(inlineMethodDeclaration, constructorPattern).Groups["SuperConstructor"].Value)) { var baseMethodDefinition = CodeUtils.ExpandAllSymbols(Regex.Match(inlineMethodDeclaration, constructorPattern).Groups["SuperConstructor"].Value.Trim()); BaseMethodDefinition = baseMethodDefinition; } ReturnType = ".ctor"; return(constructorName); } var basicMethodPattern = @"^(?'ReturnType'[\.\[\]\w\s\<\>\,\?]*)\s(?'MemberName'[\.\w]+)\s*__PARENTHESIS__[0-9]+__$"; var basicMethodName = Regex.Match(inlineMethodDeclaration, basicMethodPattern).Groups["MemberName"].Value; if (!string.IsNullOrWhiteSpace(basicMethodName)) { ReturnType = CodeUtils.ExpandAllSymbols(Regex.Match(inlineMethodDeclaration, basicMethodPattern).Groups["ReturnType"].Value.Trim(), true); if (string.IsNullOrWhiteSpace(ReturnType)) { throw new CodeParseException("Could not parse Return Type for Member"); } if (Regex.Match(basicMethodName, "__OPERATOR__[0-9]+__").Success) { MethodType = DefinedMethodType.Operator; ReturnType = ReturnType.Replace("operator", "").Trim(); return(Operator.ExpandContent(basicMethodName)); } MethodType = DefinedMethodType.Basic; return(basicMethodName); } var genericTypePattern = @"^(?'ReturnType'[\w\s\<\>\,]+)\s(?'MemberName'\w+)<(?'GenericType'[\w\.\s\,]+)>\s*__PARENTHESIS__[0-9]+__($|(?'GenericTypeConditions'[\w\s]+\:[\:\<\>\w\s\,\(\)]+))"; var genericMethodMatch = Regex.Match(inlineMethodDeclaration, genericTypePattern); if (!string.IsNullOrWhiteSpace(genericMethodMatch.Groups["MemberName"].Value)) { MethodType = DefinedMethodType.Generic; GenericMethodType = genericMethodMatch.Groups["GenericType"].Value; ReturnType = genericMethodMatch.Groups["ReturnType"].Value; if (!string.IsNullOrWhiteSpace(genericMethodMatch.Groups["GenericTypeConditions"].Value)) { _condensedGenericMethodTypeConditions = genericMethodMatch.Groups["GenericTypeConditions"].Value.Trim(); } return(genericMethodMatch.Groups["MemberName"].Value); } throw new CodeParseException("Could not parse Method Name"); }
private void getSetterBlock(string inlineContent) { var setterPattern = @"[^\s;]*set(?'SetterBlock'\s*BLOCK#[0-9]+#)"; var setter = Regex.Match(inlineContent, setterPattern); if (setter.Success) { var block = setter.Groups["SetterBlock"].Value; if (block != ";") { SetterBlock = CodeUtils.ExpandAllSymbols(block, true).Trim(); } } }
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]); }