Re: Checking scripts for syntax errors
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: Checking scripts for syntax errors

From: Andreas Wilm <wilm@biophys.uni-duesseldorf.de>
Date: Thu Jun 02 2005 - 17:34:06 CEST

> We have an application that executes Tcl scripts, some of them created
> by users. I tried to make a C code that checks these scripts to detect
> as many errors as possible, but I have some problems. Can someone help
> me with informations about how to find errors like the ones described
> below?
...
> Example 1:
>
> proc myProc { val } {
> if {val < 1}
> set x 0
> }
> }
> myProc 3
>
> no error is detected (should be "Variable references require preceding
> $" in expression "val < 1").
>
>
> Example 2:
>
> if {$val < 1}
> set x 0
> }
>
> the error is:
> wrong # args: no script following "{$val < 1}" argument
>
>
> Example 3:
>
> {
> if {$val < 1}
> set x 0
> }
>
> no error is detected, but when the script is evaluated, due to the
> extra bracket on line 1, the error is:
> invalid command name "
> if {$val < 1}
> set x 0
> "

Try nagelfar http://spjuth.pointclark.net/Nagelfar.html
I think it will find all of the above described errors.

Andreas

-- 
Andreas Wilm
Institut fuer Physikalische Biologie
Heinrich-Heine-Universitaet Duesseldorf
http://www.biophys.uni-duesseldorf.de
E-Mail: wilm@biophys.uni-duesseldorf.de / 0x7C68FBCC
Phone:  +49 211 8115966
Received on Thu Sep 29 14:20:00 2005