Thread: String Parsing
View Single Post
  #20  
Old 03-22-2008, 05:54 AM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by Tolnaftate2004 View Post
Though, I'm willing to help make a limited eval() if there is enough demand for it.
Quote:
Originally Posted by Programmer View Post
You can't convert that to gScript unless we have an eval() function
Attached is a script for eval() for doing math. It can handle almost any gscript operator right now ('new' and ?: I have omitted, and 'in' because this does not yet support arrays for all I know). It recognizes this. variables in a very elementary way. Strings, GUI objects/TStaticVar/etc, and functions are not supported at this time, as well as op= operators, ++ pre and post increment operators, -- pre and post decrement operators, and the like.

I would perhaps make this a class and join it to a static variable.
PHP Code:
echo(this.eval("((2&&3)+(this.f=97.3))")); // 98.3
echo(this.f);                              // 97.3 
Attached Files
File Type: txt math.parser.txt (6.1 KB, 117 views)
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/

Last edited by Tolnaftate2004; 03-24-2008 at 04:05 AM..
Reply With Quote