Code Monkey home page Code Monkey logo

Comments (3)

atsepkov avatar atsepkov commented on July 20, 2024

Could you attach a file that causes this error? I tried using vim and 'cat'ing to a file, with no newline in either case and couldn't reproduce the error. Maybe there is another special character at the end?

from rapydscript.

croepha avatar croepha commented on July 20, 2024

I am not confident in my ability to upload or post a file in any way that won't mangle the newlines (i guess I could tar it up... let me know if this isn't enough)

$ echo "def test():" > test2.pyj
$ echo -en "\tprint(\"HI\")" >> test2.pyj
$ rapydscript test2.pyj
WARN: ERROR: Unexpected token: eof «undefined» [test2.pyj:2,12]

/RapydScript/lib/parse.js:122
    throw new JS_Parse_Error(message, line, col, pos);
          ^
Error
    at new JS_Parse_Error (/RapydScript/lib/parse.js:110:18)
    at js_error (/RapydScript/lib/parse.js:122:11)
    at croak (/RapydScript/lib/parse.js:707:9)
    at token_error (/RapydScript/lib/parse.js:710:9)
    at unexpected (/RapydScript/lib/parse.js:716:9)
    at block_ (/RapydScript/lib/parse.js:1523:21)
    at /RapydScript/lib/parse.js:1453:21
    at /RapydScript/lib/parse.js:1460:15
    at /RapydScript/lib/parse.js:938:24
    at /RapydScript/lib/parse.js:747:20
$ hexdump -C test2.pyj 
00000000  64 65 66 20 74 65 73 74  28 29 3a 0a 09 70 72 69  |def test():..pri|
00000010  6e 74 28 22 48 49 22 29                           |nt("HI")|
00000018
$ echo  >> test2.pyj
$ rapydscript test2.pyj
(function(){function _$rapyd$_print(){var args,output;args=[].slice.call(arguments,0);output=JSON.stringify(args);if("console"in window)console.log(output.substr(1,output.length-2))}function test(){_$rapyd$_print("HI")}})();

$ hexdump -C test2.pyj 
00000000  64 65 66 20 74 65 73 74  28 29 3a 0a 09 70 72 69  |def test():..pri|
00000010  6e 74 28 22 48 49 22 29  0a                       |nt("HI").|
00000019

from rapydscript.

atsepkov avatar atsepkov commented on July 20, 2024

Ok, this makes more sense. My example was echo -en "a=1", but it seems like the file has to end with a function/block for this error to trigger.

from rapydscript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.