If you look at the KixDev package on my site, the KGen tool will automatically tokenize your scripts. KGen is a form of Link Editor - you create your script in a .TXT file, referencing any of the UDFs located in a library folder. KGen will index your UDFs, determine which were referenced, and generate a script by combining your .TXT file, any .UDF files from your project folder, and all referenced .UDF files from the library. Based on an optional config file setting or command-line arg, it will tokenize the script. It always leaves a .GEN file in plain text, and creates logs of what UDFs were used and a log of if/case/loop references to help identify missing closure statements.

KGen also invokes the Sanity UDF, which documents variable usage, insures vars are properly declared, paired tokens (if/endif) match, and quotes and parens match. I use KGen for every script, no matter how small, just to find these minor issues.

Glenn

PS - KixDev is free for download and is provided in Kix/Bat source. It includes a copy of our UDF library and full documentation.
_________________________
Actually I am a Rocket Scientist! \:D