Wimapon, the following code will (should) produce a simple list of all allocated variables found in a source code file (pb/pbi). 
4) Crude: only been tested on my files - a different programming style might reveal gotchas
 Auto-Scroll to found Var row (Windows OS only). Thanks to PB for the code snippet. 
Code: Select all
;ListVars.pb PB5.30 x86 Unicode [15/09/2014]
UsePNGImageDecoder()
EnableExplicit
Enumeration
#Win
#FileIO
#TxtFileIn
#StrFileIn
#BtnBrowse
#RightClickPop
#List
#MenuFind
#MenuHilt
EndEnumeration
Structure VarList
sLine.s
sVar.s
EndStructure
Global   sgDefaultFolder.s = "C:\"
Global      igBtnBrwsImg.i = CatchImage(10,?BtnBrowse)
Global          igFormat.i = 0
Global         qgFileLen.q = 0
Global          *gTextBuff
Global      igGridColour.i = RGB(000,000,196)
Global      igListColour.i = RGB(196,196,196)
Global igLabelTextColour.i = RGB(000,128,255)
Global   igStrTextColour.i = RGB(016,016,016)
Global       igWinColour.i = RGB(056,056,056)
Global   igHiLightColour.i = RGB(255,255,000)
Global       igFontGui10.i = LoadFont(0, "Microsoft Sans Serif", 10, #PB_Font_HighQuality + 2)
Global      igFontStrs12.i = LoadFont(1, "Microsoft Sans Serif", 12, #PB_Font_HighQuality + 2)
Global NewList Vars.VarList()
Procedure PfPopUp()
;------------------
              DisplayPopupMenu(#RightClickPop, WindowID(#Win))
EndProcedure
Procedure UnhighlightVar()
;-------------------------
Protected iRow.i = 0, iCol1.i = 1
Protected iTotalRows.i = CountGadgetItems(#List)
               For iRow = 0 To (iTotalRows - 1)
                       SetGadgetItemColor(#List, iRow, #PB_Gadget_BackColor, igListColour, iCol1)
               Next
EndProcedure
Procedure FindVar()
;------------------
Protected sVarToFind.s = InputRequester("Find Var", "Input Var Name to Find", "")
Protected iCol1.i = 1, iFoundCnt.i = 0, iRow.i = 0, iLastFoundRow.i = 0
Protected sMsg.s
               ForEach Vars()
                        If(Vars()\sVar = sVarToFind)
                                     iFoundCnt = iFoundCnt + 1
                                 iLastFoundRow = iRow
                                 SetGadgetItemColor(#List, iRow, #PB_Gadget_BackColor, igHiLightColour, iCol1)
                        EndIf
                        iRow = iRow + 1
               Next
               If(iFoundCnt > 0)
                           SetGadgetState(#List, -1)
                       SetGadgetItemState(#List, iLastFoundRow, #PB_ListIcon_Selected)
                             SendMessage_(GadgetID(#List), #LVM_ENSUREVISIBLE, iLastFoundRow, 0) ;scroll to.
                       sMsg = "Found: " + Str(iFoundCnt) + " times"
                       MessageRequester("Var Found", sMsg, #PB_MessageRequester_Ok | #MB_ICONINFORMATION)
               Else
                       sMsg = "Var: " + sVarToFind + " Not Found"
                       MessageRequester("Var Not Found", sMsg, #PB_MessageRequester_Ok | #MB_ICONINFORMATION)
               EndIf
EndProcedure
Procedure ListVars()
;-------------------
Protected qStart.q, qLen.q, qLineLen.q
Protected iPosn.i, iEquals.i, iLine.i, iVarCnt.i
Protected iIgnore.i, iIgnore1.i, iIgnore2.i, iIgnore3.i, iIgnore4.i
Protected sLine.s, sCodeLine.s, sVar1.s,  sVar2.s, sVarRev.s
              Repeat
                           iPosn = FindString(PeekS(*gTextBuff, qgFileLen, igFormat), #CRLF$, qStart, #PB_String_NoCase)
                        If(iPosn = 0) : Break : EndIf
                           sLine = Mid(PeekS(*gTextBuff, qgFileLen, igFormat), qStart, (iPosn - qStart))
                       sCodeLine = Trim(sLine)
                        qLineLen = StringByteLength(sLine, igFormat)
                          qStart = iPosn + Len(#CRLF$)
                            qLen = qLen + qLineLen
                           iLine = iLine + 1
                         iEquals = CountString(sCodeLine, "=")
                      If(iEquals = 1)
                                    sVar1 = StringField(sCodeLine, 1, "=")
                                    sVar2 = Trim(sVar1)
                                  sVarRev = ReverseString(sVar2)
                                    sVar1 = StringField(sVarRev, 1, " ")
                                    sVar2 = ReverseString(sVar1)
                                 iIgnore1 = CountString(sVar2, ";")
                                 iIgnore2 = CountString(sVar2, "If")
                                 iIgnore3 = CountString(sVar2, "(")
                                 iIgnore4 = CountString(sVar2, ")")
                                  iIgnore = iIgnore1 + iIgnore2 + iIgnore3 + iIgnore4
                               If(iIgnore < 1)
                                          AddElement(Vars())
                                                     Vars()\sLine = RSet(Str(iLine), 6, "0")
                                                     Vars()\sVar = sVar2
                                          iVarCnt = iVarCnt + 1
                                          SetWindowTitle(#Win, "List Vars " + "[" + RSet(Str(iVarCnt), 6, "0") + "]")
                               EndIf
                      EndIf
              Until((qLen = qgFileLen) Or (qLen > qgFileLen))
              ;Populate ListIcon
              SortStructuredList(Vars(), #PB_Sort_Ascending, OffsetOf(VarList\sVar), TypeOf(VarList\sVar))
              SendMessage_(GadgetID(#List),#WM_SETREDRAW,0,0) ;Faster update
              ForEach Vars()
                      AddGadgetItem(#List, -1, Vars()\sLine + Chr(10) + Vars()\sVar)
              Next
              SendMessage_(GadgetID(#List),#WM_SETREDRAW,1,0)
                   HideGadget(#List, #False)
EndProcedure
Procedure PfReadFile(sFullPath.s)
;--------------------------------
               If ReadFile(#FileIO, sFullPath)
                        igFormat = ReadStringFormat(#FileIO)
                       qgFileLen = Lof(#FileIO)
                      *gTextBuff = AllocateMemory(qgFileLen)
                       ReadData(#FileIO, *gTextBuff, qgFileLen)
                      CloseFile(#FileIO)
               Else
                      MessageRequester("List Vars", "Problem: Could not open file", #MB_ICONERROR)
               EndIf
EndProcedure
Procedure BrowseForFile()
;------------------------
Protected      sPat.s = "PB file (*.pb *.pbi)|*.pb;*.pbi|All files (*.*)|*.*"
Protected sFullPath.s = OpenFileRequester("List Vars: " + "Browse to and Select File", sgDefaultFolder, sPat, 0)
Protected qFileSize.q = FileSize(sFullPath) ;Tests if path is valid
              If(qFileSize > -1)
                        SetWindowTitle(#Win, "List Vars")
                         SetGadgetText(#StrFileIn, sFullPath)
                      ClearGadgetItems(#List)
                             ClearList(Vars())
                            HideGadget(#List, #True)
                      While WindowEvent() : Wend
                      sgDefaultFolder = GetPathPart(sFullPath)
                      PfReadFile(sFullPath)
                        ListVars()
              EndIf
EndProcedure
Procedure Win()
;--------------
Protected iExit = #False, iCol1 = 1
              If OpenWindow(#Win, 0, 0, 300, 265, "List Vars", #PB_Window_SizeGadget | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_ScreenCentered)
                            SetWindowColor(#Win,igWinColour)
                             If CreatePopupMenu(#RightClickPop)
                                       MenuItem(#MenuFind,  "Find Var")
                                       MenuItem(#MenuHilt,  "Un-highlight Vars")
                             EndIf
                                TextGadget(#TxtFileIn,    5,   6, 260,  16, "File")
                              StringGadget(#StrFileIn,    5,  24, 260,  26, "", #PB_String_BorderLess | #PB_String_ReadOnly)
                         ButtonImageGadget(#BtnBrowse,  270,  24,  26,  26, igBtnBrwsImg)
                            ListIconGadget(#List,         0,  60, 300, 205, "Line", 85, #PB_ListIcon_GridLines | #PB_ListIcon_AlwaysShowSelection)
                           AddGadgetColumn(#List, iCol1, "Var", 200)
                             SetGadgetFont(#TxtFileIn, igFontGui10)
                             SetGadgetFont(#StrFileIn, igFontStrs12)
                             SetGadgetFont(#List, igFontStrs12)
                            SetGadgetColor(#TxtFileIn, #PB_Gadget_FrontColor, igLabelTextColour)
                            SetGadgetColor(#TxtFileIn, #PB_Gadget_BackColor, igWinColour)
                            SetGadgetColor(#List, #PB_Gadget_FrontColor, igStrTextColour)
                            SetGadgetColor(#List, #PB_Gadget_BackColor, igListColour)
                            SetGadgetColor(#List, #PB_Gadget_LineColor, igGridColour)
                           BindGadgetEvent(#List, @PfPopUp(), #PB_EventType_RightClick)
                     Repeat
                           Select WaitWindowEvent(1)
                                      Case #PB_Event_CloseWindow: iExit = #True
                                      Case #PB_Event_RestoreWindow, #PB_Event_SizeWindow
                                                                    ;X                      ;Y          ;W                      ;H
                                           ResizeGadget(#List,      #PB_Ignore,             #PB_Ignore, WindowWidth(#Win),      WindowHeight(#Win) - 60)
                                           ResizeGadget(#StrFileIn, #PB_Ignore,             #PB_Ignore, WindowWidth(#Win) - 40, #PB_Ignore)
                                           ResizeGadget(#BtnBrowse, WindowWidth(#Win) - 30, #PB_Ignore, #PB_Ignore,             #PB_Ignore)
                                           SetGadgetItemAttribute(#List, #Null, #PB_ListIcon_ColumnWidth, WindowWidth(#Win) - 115, iCol1)
                                      Case #PB_Event_Gadget
                                                 Select EventGadget()
                                                            Case #BtnBrowse: BrowseForFile()
                                                 EndSelect
                                     Case #PB_Event_Menu
                                                 Select EventMenu()
                                                          Case  #MenuFind: FindVar()
                                                          Case  #MenuHilt: UnhighlightVar()
                                                 EndSelect
                           EndSelect
                     Until iExit = #True
              EndIf
EndProcedure
Win()
End
DataSection
  BtnBrowse:
  Data.q $0A1A0A0D474E5089,$524448490D000000,$1800000018000000,$3D77E00000000608,$59487009000000F8
  Data.q $0E0000C40E000073,$00001B0E2B9501C4,$DE07454D49740700,$24B9FB01330F0201,$584574070000005F
  Data.q $00726F6874754174,$0C00000048CCAEA9,$6373654474584574,$006E6F6974706972,$0A00000023210913
  Data.q $79706F4374584574,$0FAC007468676972,$45740E0000003ACC,$6974616572437458,$00656D6974206E6F
  Data.q $09000000090FF735,$74666F5374584574,$FF705D0065726177,$5845740B0000003A,$69616C6373694474
  Data.q $8FB4C0B70072656D,$7458457408000000,$00676E696E726157,$0700000087E61BC0,$72756F5374584574
  Data.q $00EB83FFF5006563,$4374584574080000,$F600746E656D6D6F,$7406000000BF96CC,$656C746954745845
  Data.q $01000027D2EEA800,$ED894854414449C9,$9F871840D36F3F95,$40A085DAA34ECFB3,$A58803A95A81235B
  Data.q $037C40622A03282C,$581958D826502DFA,$6C426262421502F9,$DC6A0924F9425448,$32F3FE7C4969A23F
  Data.q $82C8512B1A88B6B8,$3BBF3F5EEFB267D4,$D3BD76EDDAA77D9F,$AC8885E8A28DBCE9,$ED5AB507529400B2
  Data.q $FA69A76D7AD5AB53,$BF2116F012F318CE,$5DDBB751E4924BC0,$2C68AA4EEC9249D6,$68E04CFBCA5B7509
  Data.q $B24924A7B3671164,$C6CA7E3B96BD27AB,$71793B5B0A52824A,$7264B9E8FC50C86C,$377FD359111135C9
  Data.q $53A7865EEB19CB04,$DF655A4FA78D6082,$E3C6FD7CBE2FC9C9,$5480324BEA986220,$6CAB73BD16679F84
  Data.q $4C7AEB615C572B2B,$37364D5BD58379B3,$E1E35C68DC3D8EEE,$7EE23953234603F6,$065D88331F4F10FF
  Data.q $E7EF3E4E78078D46,$556DEFF7052A76CF,$91DF19F8F87C15F6,$4EE3B4028B9CA032,$558159AC5F434C15
  Data.q $C3A2A602AE30B751,$2B6A729869600430,$FB8F4F093FC1EFCC,$2201E76678421D1C,$FE3397E42229E7F9
  Data.q $AFFFFBC29E1415A6,$6C409901ECC055C1,$8A234E5BBD54510C,$082A179D8F1C710C,$0476E7612D700102
  Data.q $1F26C5E9B7CEE380,$A032A9930D6EF7DC,$4A19EB372117AC07,$29568708110337CD,$98015E03D81A7A07
  Data.q $664FB3E7B73DD14C,$4D80701F7F7DF6CF,$DE07BC07B8905FC0,$DDB042AFD70A01FC,$454900000000060C
  Data.q $0000826042AE444E
EndDataSection