hscript error: unexpected '[' in Interp.class.php

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

hscript error: unexpected '[' in Interp.class.php

Ben Aurel
hi
I try to run hscript with php. The compilation with haxe goes fine,
but when I want to run the script, I get the following error:

     $ php index.php
     Parse error: syntax error, unexpected '[' in
/.../Interp.class.php on line 141

Following the whole process

===== 1.) the source file: =====

  $ cat Test.hx
    class Test {

        static function test(x,v:Dynamic,?vars : Dynamic) {
                var p = new hscript.Parser();
                var program = p.parseString(x);
                var bytes = hscript.Bytes.encode(program);
                program = hscript.Bytes.decode(bytes);
                var interp = new hscript.Interp();
                if( vars != null )
                        for( v in Reflect.fields(vars) )
                                interp.variables.set(v,Reflect.field(vars,v));
                var ret : Dynamic = interp.execute(program);
                if( v != ret ) throw ret+" returned while "+v+" expected";
        }

        static function main() {
                test("5 > 3",true);
                trace("Done");
        }

    }

===== 2.) the hxml build script: =====

     $ cat hscript.hxml
    -php www
    -main Test
    -debug

===== 3.) compile =====

    haxe -lib hscript hscript.hxml

===== 4.) run it =====

    $ cd www
    $ php index.php
    Parse error: syntax error, unexpected '[' in /.../Interp.class.php
on line 141

===== 5.) the excerpt from Interp.class.php =====
...
138         case 16:
139         $index = $__t__->params[1]; $e3 = $__t__->params[0];
140         {
141             $this->expr($e3)[$this->expr($index)] = $v;
---------------------------------------------------------------------------
142         }break;
...


Any ideas?
Thanks in advance
ben

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: hscript error: unexpected '[' in Interp.class.php

Franco Ponticelli
I have added this problem to my todo list. In the meanwhile you can change the Interp class this way at line 101:

var t = expr(e);
t[expr(index)] = v;

Franco.


On Mon, Oct 27, 2008 at 7:47 PM, Ben Aurel <[hidden email]> wrote:
hi
I try to run hscript with php. The compilation with haxe goes fine,
but when I want to run the script, I get the following error:

    $ php index.php
    Parse error: syntax error, unexpected '[' in
/.../Interp.class.php on line 141

Following the whole process

===== 1.) the source file: =====

 $ cat Test.hx
   class Test {

       static function test(x,v:Dynamic,?vars : Dynamic) {
               var p = new hscript.Parser();
               var program = p.parseString(x);
               var bytes = hscript.Bytes.encode(program);
               program = hscript.Bytes.decode(bytes);
               var interp = new hscript.Interp();
               if( vars != null )
                       for( v in Reflect.fields(vars) )
                               interp.variables.set(v,Reflect.field(vars,v));
               var ret : Dynamic = interp.execute(program);
               if( v != ret ) throw ret+" returned while "+v+" expected";
       }

       static function main() {
               test("5 > 3",true);
               trace("Done");
       }

   }

===== 2.) the hxml build script: =====

    $ cat hscript.hxml
   -php www
   -main Test
   -debug

===== 3.) compile =====

   haxe -lib hscript hscript.hxml

===== 4.) run it =====

   $ cd www
   $ php index.php
   Parse error: syntax error, unexpected '[' in /.../Interp.class.php
on line 141

===== 5.) the excerpt from Interp.class.php =====
...
138         case 16:
139         $index = $__t__->params[1]; $e3 = $__t__->params[0];
140         {
141             $this->expr($e3)[$this->expr($index)] = $v;
---------------------------------------------------------------------------
142         }break;
...


Any ideas?
Thanks in advance
ben

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: hscript error: unexpected '[' in Interp.class.php

Franco Ponticelli
Should be fixed on CVS, thank you for reporting.

Franco.

On Wed, Oct 29, 2008 at 11:21 AM, Franco Ponticelli <[hidden email]> wrote:
I have added this problem to my todo list. In the meanwhile you can change the Interp class this way at line 101:

var t = expr(e);
t[expr(index)] = v;

Franco.


On Mon, Oct 27, 2008 at 7:47 PM, Ben Aurel <[hidden email]> wrote:
hi
I try to run hscript with php. The compilation with haxe goes fine,
but when I want to run the script, I get the following error:

    $ php index.php
    Parse error: syntax error, unexpected '[' in
/.../Interp.class.php on line 141

Following the whole process

===== 1.) the source file: =====

 $ cat Test.hx
   class Test {

       static function test(x,v:Dynamic,?vars : Dynamic) {
               var p = new hscript.Parser();
               var program = p.parseString(x);
               var bytes = hscript.Bytes.encode(program);
               program = hscript.Bytes.decode(bytes);
               var interp = new hscript.Interp();
               if( vars != null )
                       for( v in Reflect.fields(vars) )
                               interp.variables.set(v,Reflect.field(vars,v));
               var ret : Dynamic = interp.execute(program);
               if( v != ret ) throw ret+" returned while "+v+" expected";
       }

       static function main() {
               test("5 > 3",true);
               trace("Done");
       }

   }

===== 2.) the hxml build script: =====

    $ cat hscript.hxml
   -php www
   -main Test
   -debug

===== 3.) compile =====

   haxe -lib hscript hscript.hxml

===== 4.) run it =====

   $ cd www
   $ php index.php
   Parse error: syntax error, unexpected '[' in /.../Interp.class.php
on line 141

===== 5.) the excerpt from Interp.class.php =====
...
138         case 16:
139         $index = $__t__->params[1]; $e3 = $__t__->params[0];
140         {
141             $this->expr($e3)[$this->expr($index)] = $v;
---------------------------------------------------------------------------
142         }break;
...


Any ideas?
Thanks in advance
ben

--
haXe - an open source web programming language
http://haxe.org



--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: hscript error: unexpected '[' in Interp.class.php

Ben Aurel
I updated haxe and can confirm that its works for me (on ubuntu)
thanks for fixing

On Wed, Oct 29, 2008 at 7:29 AM, Franco Ponticelli
<[hidden email]> wrote:

> Should be fixed on CVS, thank you for reporting.
> Franco.
>
> On Wed, Oct 29, 2008 at 11:21 AM, Franco Ponticelli
> <[hidden email]> wrote:
>>
>> I have added this problem to my todo list. In the meanwhile you can change
>> the Interp class this way at line 101:
>> var t = expr(e);
>> t[expr(index)] = v;
>> Franco.
>>
>> On Mon, Oct 27, 2008 at 7:47 PM, Ben Aurel <[hidden email]> wrote:
>>>
>>> hi
>>> I try to run hscript with php. The compilation with haxe goes fine,
>>> but when I want to run the script, I get the following error:
>>>
>>>     $ php index.php
>>>     Parse error: syntax error, unexpected '[' in
>>> /.../Interp.class.php on line 141
>>>
>>> Following the whole process
>>>
>>> ===== 1.) the source file: =====
>>>
>>>  $ cat Test.hx
>>>    class Test {
>>>
>>>        static function test(x,v:Dynamic,?vars : Dynamic) {
>>>                var p = new hscript.Parser();
>>>                var program = p.parseString(x);
>>>                var bytes = hscript.Bytes.encode(program);
>>>                program = hscript.Bytes.decode(bytes);
>>>                var interp = new hscript.Interp();
>>>                if( vars != null )
>>>                        for( v in Reflect.fields(vars) )
>>>
>>>  interp.variables.set(v,Reflect.field(vars,v));
>>>                var ret : Dynamic = interp.execute(program);
>>>                if( v != ret ) throw ret+" returned while "+v+" expected";
>>>        }
>>>
>>>        static function main() {
>>>                test("5 > 3",true);
>>>                trace("Done");
>>>        }
>>>
>>>    }
>>>
>>> ===== 2.) the hxml build script: =====
>>>
>>>     $ cat hscript.hxml
>>>    -php www
>>>    -main Test
>>>    -debug
>>>
>>> ===== 3.) compile =====
>>>
>>>    haxe -lib hscript hscript.hxml
>>>
>>> ===== 4.) run it =====
>>>
>>>    $ cd www
>>>    $ php index.php
>>>    Parse error: syntax error, unexpected '[' in /.../Interp.class.php
>>> on line 141
>>>
>>> ===== 5.) the excerpt from Interp.class.php =====
>>> ...
>>> 138         case 16:
>>> 139         $index = $__t__->params[1]; $e3 = $__t__->params[0];
>>> 140         {
>>> 141             $this->expr($e3)[$this->expr($index)] = $v;
>>>
>>> ---------------------------------------------------------------------------
>>> 142         }break;
>>> ...
>>>
>>>
>>> Any ideas?
>>> Thanks in advance
>>> ben
>>>
>>> --
>>> haXe - an open source web programming language
>>> http://haxe.org
>>
>
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org