private FunctionDeclaration ReadFuncType(string line, int curLine) { var parser = new LineParser(line, curLine); // Skip the typedef parser.SkipNextToken(); // Read the return type var returnType = parser.ReadUntil('('); if (!parser.IsSymbol('(')) { Console.Error.WriteLine($"Failed to parse function type declaration at line {curLine}:{parser.CurIdx} - Expected (, got {parser.ReadChar()}"); return(null); } var apiEntry = parser.ReadToken(); if (apiEntry != "APIENTRYP") { return(null); } var typedefName = parser.ReadToken(); if (!parser.IsSymbol(')')) { Console.Error.WriteLine($"Failed to parse function type declaration for declaration {typedefName} at line {curLine}:{parser.CurIdx} - Expected ), got {parser.ReadChar()}"); return(null); } if (!parser.IsSymbol('(')) { Console.Error.WriteLine($"Failed to parse function type declaration for declaration {typedefName} at line {curLine}:{parser.CurIdx} - Expected (, got {parser.ReadChar()}"); return(null); } var funcType = new FunctionDeclaration(); funcType.TypedefName = typedefName; funcType.ReturnType = returnType; while (!parser.IsSymbol(')')) { var argString = parser.ReadUntil(',', ')'); var arg = new FunctionArgument(argString); if (arg.Name != null && arg.Type != null && arg.Name.Length > 0 && arg.Type.Length > 0) { funcType.Arguments.Add(arg); } parser.IsSymbol(','); } FunctionTypes.Add(funcType.TypedefName, funcType); return(funcType); }
public bool addFunctionTypes(FunctionItem functionItem) { if (functionItem != null) { FunctionTypes.Add(functionItem); return(true); } return(false); }