Issue 6: hscript interpreter compiling error
Status:  Fixed
Owner: ----
Closed:  Jul 2010
Reported by aboutwh...@googlemail.com, Jan 19, 2010
What steps will reproduce the problem?
package;
class Main {
	
	public static function main ():Void 
	{
		var script = '5+5';
		var p = new hscript.Parser();
		var expr = p.parseString(script);
		var interp = new hscript.Interp();
		var res = interp.execute(expr);
		trace(res);
	}
}
What is the expected output? 
successfull cpp compilation

What do you see instead?
cl.exe -I. -nologo -O2 -MT -DHX_WINDOWS -GR -Zi -c -EHsc -IC:\Program
Files\Motion-Twin\haxe\lib\hxcpp
\2,05,1/include -D_CRT_SECURE_NO_DEPRECATE -wd4996 -Iinclude -Yuhxcpp.h
./src/hscript/Interp.cpp -Foob
j/Release/src/hscript/Interp.obj
Interp.cpp
./src/hscript/Interp.cpp(807) : error C2593: 'operator ~' is ambiguous
        could be 'built-in C++ operator~(int)'
        or       'built-in C++ operator~(unsigned char)'
        or       'built-in C++ operator~(bool)'
        while trying to match the argument list '(Dynamic)'
Called from <null> line 1
Called from BuildTool.hx line 840
Called from BuildTool.hx line 433
Called from BuildTool.hx line 456
Called from BuildTool.hx line 529
Called from BuildTool.hx line 600
Uncaught exception - Error in building thread
Error : Build failed

What version of the product are you using? On what operating system?
2.05.1, latest hscript

Please provide any additional information below.
the haxe code that produces the error is in line 254
case "~":
#if neko
return haxe.Int32.complement(expr(e));
#else
return ~expr(e);
#end

this solves the problem for me, but i'm not sure if this is the best solution
return ~cast(expr(e), Int);
Jan 19, 2010
#1 aboutwh...@googlemail.com
i'm not sure if this is a problem which is related to hxcpp or hscript
Apr 5, 2010
Project Member #2 gameh...@gmail.com
Hi,
 
just figured out that there are a lot of issues regarding hscript and the cpp-target.
 
I'm not sure if these problems are hxcpp or hscript related:
 
these examples does are not working as expected
 
var script = '[10]';
var script = 'trace(5)';
var script = 'new Array()';
 
these examples can not be parsed:
EUnexpected
 
maybe there is an general issue with brackets.
 
testclass:
 
package;
class Main {
 
    public static function main ():Void
    {
        var scriptA = '[10]';
        var scriptB = 'trace(5)';
        var scriptC = 'new Array()';
        var p = new hscript.Parser();
 
        try {
            trace(p.parseString(scriptA));
        } catch (e : Dynamic) {
            trace("Error: " + e);
        }
        try {
            trace(p.parseString(scriptB));
        } catch (e : Dynamic) {
            trace("Error: " + e);
        }
        try {
            trace(p.parseString(scriptC));
        } catch (e : Dynamic) {
            trace("Error: " + e);
        }
 
 
    }
}
 
and theres also an problem with the interp for cpp, i posted
this issue and a possible solution here (i wasn't sure if this is hxcpp or hscript 
related)
 
https://code.google.com/p/hxcpp/issues/detail?id=6
 
cheers
heinz
 
Jul 21, 2010
Project Member #3 gameh...@gmail.com
This should be fixed with hxcpp/haxe svn changes.
Status: Fixed