public static ParsedField GetParsedField(string line) { Scope scope; ParsedType type; string variableName; bool isConst; string valueToAssignTo; bool isVirtual; bool isOverride; bool isStatic; bool isNew; bool isAsync; ParsedMethod.GetLineInformation(line, out scope, out type, out variableName, out isConst, out isVirtual, out isOverride, out isStatic, out isNew, out isAsync, out valueToAssignTo); ParsedField parsedField = new ParsedField(); parsedField.Scope = scope; parsedField.Type = type; parsedField.Name = variableName; parsedField.IsConst = isConst; parsedField.IsStatic = isStatic; parsedField.ValueToAssignTo = valueToAssignTo; return(parsedField); }
private void ParseField(string line) { ParsedField parsedField = GetParsedField(line); // todo: parsedField add attributes this.CurrentAttributes.Clear(); mParsedFields.Add(parsedField); }
public ParsedField Clone() { ParsedField newField = (ParsedField)this.MemberwiseClone(); newField.Type = Type.Clone(); return(newField); }
internal static ParsedField FromFieldInfo(System.Reflection.FieldInfo field) { ParsedField toReturn = new ParsedField(); toReturn.Name = field.Name; toReturn.Type = new ParsedType( field.FieldType.Name); toReturn.IsStatic = field.IsStatic; return toReturn; }
internal static ParsedField FromFieldInfo(System.Reflection.FieldInfo field) { ParsedField toReturn = new ParsedField(); toReturn.Name = field.Name; toReturn.Type = new ParsedType(field.FieldType.Name); toReturn.IsStatic = field.IsStatic; return(toReturn); }
public ParsedField GetField(string fieldName) { foreach (ParsedField parsedField in mParsedFields) { if (parsedField.Name == fieldName) { return(parsedField); } } foreach (ParsedClass parentClass in mParentParsedClasses) { ParsedField parsedField = parentClass.GetField(fieldName); if (parsedField != null) { return(parsedField); } } return(null); }
public static ParsedClass FromType(Type type) { ParsedClass toReturn = new ParsedClass(); var fieldInfos = type.GetFields(); foreach (var field in fieldInfos) { ParsedField parsedField = ParsedField.FromFieldInfo(field); toReturn.ParsedFields.Add(parsedField); } var propertyInfos = type.GetProperties(); foreach (var property in propertyInfos) { ParsedProperty parsedProperty = ParsedProperty.FromPropertyInfo(property); toReturn.ParsedProperties.Add(parsedProperty); } return(toReturn); }
internal void FillArgumentList(ParsedMethod parsedMethod, List <string> currentBlock, int lineIndex, bool requireTypes) { int wordIndex = 0; int parenthesisDeep = 0; bool hasFoundClosedParenthesis = false; ParsedField argumentToAddTo = null; while (!hasFoundClosedParenthesis) { string line = currentBlock[lineIndex]; wordIndex = 0; string currentType = null; while (true) { string word = ParsedClass.GetWord(line, ref wordIndex); if (word == "(") { if (argumentToAddTo != null) { argumentToAddTo.Name += word; } parenthesisDeep++; } else if (word == ")") { parenthesisDeep--; if (parenthesisDeep == 0) { hasFoundClosedParenthesis = true; break; } else if (argumentToAddTo != null) { argumentToAddTo.Name += word; } } else if (word == "") { lineIndex++; break; } else if (parenthesisDeep == 0) { continue; } else if (word == ",") { argumentToAddTo = null; continue; } else if (currentType == null && requireTypes) { currentType = word; } else { ParsedField parsedField = new ParsedField(Scope.Public, currentType, word); currentType = null; parsedMethod.ArgumentList.Add(parsedField); argumentToAddTo = parsedField; } } } }
public static ParsedField GetParsedField(string line) { Scope scope; ParsedType type; string variableName; bool isConst; string valueToAssignTo; bool isVirtual; bool isOverride; bool isStatic; bool isNew; bool isAsync; ParsedMethod.GetLineInformation(line, out scope, out type, out variableName, out isConst, out isVirtual, out isOverride, out isStatic, out isNew, out isAsync, out valueToAssignTo); ParsedField parsedField = new ParsedField(); parsedField.Scope = scope; parsedField.Type = type; parsedField.Name = variableName; parsedField.IsConst = isConst; parsedField.IsStatic = isStatic; parsedField.ValueToAssignTo = valueToAssignTo; return parsedField; }
internal void FillArgumentList(ParsedMethod parsedMethod, List<string> currentBlock, int lineIndex, bool requireTypes) { int wordIndex = 0; int parenthesisDeep = 0; bool hasFoundClosedParenthesis = false; ParsedField argumentToAddTo = null; while (!hasFoundClosedParenthesis) { string line = currentBlock[lineIndex]; wordIndex = 0; string currentType = null; while (true) { string word = ParsedClass.GetWord(line, ref wordIndex); if (word == "(") { if (argumentToAddTo != null) { argumentToAddTo.Name += word; } parenthesisDeep++; } else if (word == ")") { parenthesisDeep--; if (parenthesisDeep == 0) { hasFoundClosedParenthesis = true; break; } else if (argumentToAddTo != null) { argumentToAddTo.Name += word; } } else if (word == "") { lineIndex++; break; } else if (parenthesisDeep == 0) { continue; } else if (word == ",") { argumentToAddTo = null; continue; } else if (currentType == null && requireTypes) { currentType = word; } else { ParsedField parsedField = new ParsedField(Scope.Public, currentType, word); currentType = null; parsedMethod.ArgumentList.Add(parsedField); argumentToAddTo = parsedField; } } } }