Fastmap Code to Javascript - can't see why it does not translate

16 views
Skip to first unread message

Henry

unread,
Aug 10, 2015, 6:04:19 PM8/10/15
to RapydScript


can't be converted to JavaScript.

Could anyone help me?


Console is returning:

rapydscript fastmap.py
util.error: Use console.error instead
WARN: ERROR: Unexpected token punc «,», expected punc «]» [fastmap.py:143,30]

Roaming\npm\node_modules\rapydscript\lib\parse.js:125
    throw new JS_Parse_Error(message, line, col, pos);
          ^
Error
    at new JS_Parse_Error \Roaming\npm\node_modules\rapydscript\lib\parse.js:113:18)
    at js_error (\Roaming\npm\node_modules\rapydscript\lib\parse.js:125:11)
    at croak (\Roaming\npm\node_modules\rapydscript\lib\parse.js:713:145)
    at token_error (AppData\Roaming\npm\node_modules\rapydscript\lib\parse.js:716:9)
    at expect_token (\AppData\Roaming\npm\node_modules\rapydscript\lib\parse.js:728:9)
    at expect (\Roaming\npm\node_modules\rapydscript\lib\parse.js:731:16)
    at subscripts (\AppData\Roaming\npm\node_modules\rapydscript\lib\parse.js:2104:13)
    at subscripts (\AppData\Roaming\npm\node_modules\rapydscript\lib\parse.js:2070:20)
    at expr_atom (\AppData\Roaming\npm\node_modules\rapydscript\lib\parse.js:1834:20)



Thanks a lot
Henry

Alexander Tsepkov

unread,
Aug 10, 2015, 7:06:44 PM8/10/15
to Henry, RapydScript
The error is exactly as the compiler says, line 143, character 30 is a comma, it expected a bracket. If you look at that line, you see the matrix index being accessed:

  1.             return self.dist[x,y] ** 2

Unfortunately, RapydScript does not support that syntax. You will have to change the logic to use good ol' arrays of arrays and access them as self.dist[x][y].

Henry Heberle

unread,
Aug 10, 2015, 7:26:43 PM8/10/15
to Alexander Tsepkov, RapydScript
I see, many thanks
Reply all
Reply to author
Forward
0 new messages