Hi everyone,
I have been playing with jsCard and I have run across a few problems in
the 'compiler.php' file.
The compiler seems to crash when "global" is used.
The compiler seems not to recognise 'put field "test" into myVar'
The code for "put" is:
case "put":
$expr = fetchExpression( $tokens, $i + 1 );
$i = $expr[ "position" ];
if ( $expr[ "position" ] >= count( $tokens ) )
{
// That's the end of the line, so this is an output put.
$source .= "document.getElementById('msgboxcontent').value = ( " .
$expr[ "result" ] . " );\n";
}
else
{
// Copy Value
$container = fetchContainer( $tokens, $i, $tokens[ $i - 1 ]["value"] );
if ( array_key_exists( "assign", $container ) )
{
//$source = $container["assign"] . " = " . str_replace( "@",
$expr["result"], $container["result"] ) . ";\n";
$source .= str_replace( "@" ,str_replace( "@", $expr["result"],
$container["result"] ), $container["assign"] ) . "\n";
}
else
{
$source .= str_replace( "@", $expr[ "result" ], $container[ "result" ] )
.. "\n";
}
}
And the code for "global" is:
case "global":
$gvr = array_pop( $globalVarRegistry );
for ( $i = 1; $i < count( $tokens ); $i += 2 )
{
array_push( $gvr, strtolower( $tokens[ $i ]["value"] ) );
}
array_push( $globalVarRegistry, $gvr );
Does anyone here know what is wrong?
Andrew
P.S. I am using the compiler included with the complete version of
jsCard available on
www.creysoft.com/xtalk<
http://www.creysoft.com/xtalk> , not the jsCard compiler by itself.
[Non-text portions of this message have been removed]