I have text file like this,
str = “function ExecMain.GetApiErrorMessage(ApiErrCode :DWORD) :String;
var
Buf: array[0…511] of Char;
MsgCnt :DWORD;
begin
function THandle.SetPrivilege(PrivilegeName: String;
Enable: Boolean): Boolean;
var
tpPrev,
tp : TTokenPrivileges;
token : THandle;
dwRetLen : DWord;
begin
function Privileges.SetPrivilege(PrivilegeName: String;
Enable: Boolean): Boolean;
var
tpPrev,
tp : Privileges;
token : THandleTest;
dwRetLen : DWord;
begin”
str =~ /(function)\s+(\w+)(.*);/
func_names = $1
puts “#{$’}”
while(str) # while(true)
str = $’ #second function
str =~ /:(\w+);/m
args = $1
str.scan(/:(\w+);/m) do |d|
puts $1 # private method error
end
if args == func_names
puts func_names
end
puts “-----------------------------”
puts “#{$’}”
end
I am writing this script for getting the function names and args names.
but there is some rules:
1- if I want to scan one function name, next time I need scan second
function name.(because I need which args belongs to which functions
name)
2- If args names same as functions names I want to print the function
name.
with this code I am not get the args name.
please help me.