it appears one of the hardest things to do in AHK is get it to understand itself :p
currently i'm looking at finding := and whatever is before it is a variable but ofcourse, variables in AHK can be defined in various ways, which leads to the problem
likewise with function names and labels, so on
is there any regex gurus out there that could verify if this is even possible?
here's a small snippet of the code that handles finding variable names, and it does a fairly decent job but it's not thorough by any means, the input of it is A_Loopreadline
Code: Select all
Checkforvars(in)
{
if instr(in, ":=")
{
o := Strsplit(in, ":=")
Variable(o[1])
return 1
}
return 0
}
variable(var)
{
global
Index +=1
;index|type|LN|name
var := regexreplace(regexreplace(var, "[^,\w]+", ""), "^\s*(\S.*\S|\S)\s*$", "$1")
LV_Add("", index, "var", LineNumber, var, "?????")
}