Heh, I have read that before (I was trying to do something similar, if I remember correctly) and have decided to instead try implementing it in a different way. My current implementation is absolutely atrocious, but I'll be improving it over time. (It does have some issue with certain types of comments, at the moment).
PHP Code:
def SearchForFunction(string):
explosion = string.split(" ")
if(explosion[0]=="stock"):
if("(" in explosion[1]):
h = explosion[1].split("(")
stocks.append(h[0])
else:
variables.append(explosion[1])
elif(explosion[0]=="public"):
if("(" in explosion[1]):
h = explosion[1].split("(")
public.append(h[0])
elif(explosion[0]=="new"):
variables.append(explosion[1])
elif(explosion[0]=="forward"):
if("(" in explosion[1]):
h = explosion[1].split("(")
forwards.append(h[0])
elif(explosion[0]=="native"):
if("(" in explosion[1]):
h = explosion[1].split("(")
natives.append(h[0])
elif("\t" not in explosion[0] and "\n" not in explosion[0] and "}" not in explosion[0] and "//" not in explosion[0]):
if("(" in explosion[0]):
h = explosion[0].split("(")
private.append(h[0])
Thankfully this isn't meant to be run inside the game, meaning I am able to use something with better string handling than sourcepawn, in this case: python.