Yeah - including the Sanity function - which is built in to KGen.

KGen is part of the Kix Development package and allows you to write scripts without manually specifying functions, and it lets you break large scripts into smaller files. Run KGEN against your primary script source file and it will combine all of the sub-files, then scan them for any needed UDFs, adding them to the finished script. It does this recursively so even UDFs with dependencies are resolved.

When KGen finishes assembling the script, it runs Sanity, which scans the full script looking for unbalanced functions, quotes, parens, checks for undeclared or duplicately defined variables, and variables or macros in strings. It even generates a variable list reporting when it was declared and first defined. A "Code Map" helps to quickly find unbalanced statements. KGen supports directives to load specific "Private" UDFs, prevent scanning for dependencies, define additional libraries, and even skip parsing of a line that's correct but always generates a warning (Execute commands often have $ in the strings).

The Kix Development pack is a free download from my site, is written in Kix and includes our entire production UDF library.

I write a large number of complex Kix scripts that we use in production, and I use KGen for every one of them. Running KGen without args will locate the BUILD.INI file, where I've configured the defaults to not tokenized the code and to run sanity. I then have 3 other sections called DEV, PKG, and PROD. These all simply build the script, tokenize the result (leaving an un-tokenized .GEN file), bypass Sanity, and then copy the resulting script to the Dev environment, a Package folder for deployment, or our Production environment.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D