Code: Select all
Loop Read,%fi%
{ If (ex="c")
{ L:="",z:=A_LoopReadLine,x=1,c1:=z~="^[^\s#]"
IfEqual true,% !(z~="/\*|\*/|//")&&cm!=2,SetEnv L,%z%
else while x<=StrLen(z)
{ y:=SubStr(z,x,2),(cm=2&&y="*/")?(cm:=0,L.=" ",x++)
: (cm=0&&y="/*")?(cm:=2, L.=" ",x++):0
IfEqual cm,0,IfEqual y,//,break
(cm=2)?x++:L.=SubStr(z,x++,1)
} } else { L:=A_LoopReadLine, ln:=cm=1?"":SubStr(LTrim(L),1,2)
cm:=ex="a"&&ln="/*"?2:cm
IfEqual true,% ex="d"&&ln="::"||ex="a"&&cm=2&&L~="\*/"&&!(cm:=0)||cm=2,continue
} L:=rr(rr(L,":="," "),":",ex="d"?" :":ex="a"?": ":" ")
L:=rr(rr(ex="c"?rr(L,"\s+\(","("):L,"(;|\()","$1 "),"((``.)|{|\)|,)"," $1 ")
L:=Trim(rr(L,"[^\w#@$;" co "``]+"," ")),ln#=A_Index,cr=0
Loop Parse,L,%A_Space% ; ^^ c?[ (=>(] [;(=>$1 ] [`?{),=> $1 ]
{ z:=A_LoopField,y:=SubStr(z,1,1),cr:=ex!="a"||cr?cr:y=";"
IfEqual true,% (ex="d"&&z="rem"||ex="a"&&y=";"), IfNotEqual cm,1,break
(ex="a"&&A_Index=1&&z<>","&&z<>"{")?f#:=0:0
fr:=ex="d"?y=":"?A_Index=1?"F":lw="call"?"R":" ":" "
:ex="c"? SubStr(z,0)="("?c1&&!cr++&&!(nf[z]&2)? "F":"R":" "
:ex="a"&&SubStr(z,0)="("&&!(nf[z]&1)?"R":" "
(ex="a"&&SubStr(z,0)="("&&A_Index>1)?f#:=0:0
(ex="a"&&z="{"&&lw=")"&&f#&&fu)?fu:=SubStr(fu,1,f#) "F" SubStr(fu,f#+2):0
(ex="a")?(SubStr(z,0)=":"&&A_Index=1?fr:="F":lw="gosub"?fr:="R"):0
lw:=cr?lw:z,x:=rr(z,"(^[{:]+)|([({;:,)]+$)")
IfEqual x,,continue
fu.=ln#>=lb&&(ln#<=le||!le)?x "/" ln# "/" ++ic "/" fr "|":""
(ex="a"&&SubStr(z,0)="("&&A_Index=1&&!(nf[z]&1))?f#:=StrLen(fu)-2:0
IfEqual ex,d,IfEqual A_Index,1,IfEqual y,:,IfNotEqual cm,1,break
} } SplashTextOff
nz:=StrLen(ln#)+1,s:=dp(nz),wz=0,b2=2*10**9,int=""
IfLess lz,% nz*4,MsgBox 8240,,% "Characters/line must be " nz*4 " or greater!"
IfLess lz,% nz*4,goto rpt
I use Notepad++ Ctrl+F → "Find all in current document" button for this goal.
Little bug: function map display hotkeys like a:: as function.