52

When I typed multiline in coffeescript interactive mode, an error occrured.

For example, I want to try the following code:

kids =
  brother:
    name: "Max"
    age:  11
  sister:
    name: "Ida"
    age:  9

This Error was displayed:

coffee> kids = 
Error: In repl, Parse error on line 1: Unexpected 'TERMINATOR'
  at Object.parseError (/usr/lib/coffeescript/parser.js:463:11)
  at Object.parse (/usr/lib/coffeescript/parser.js:533:22)
  at /usr/lib/coffeescript/coffee-script.js:26:22
  at Object.eval (/usr/lib/coffeescript/coffee-script.js:64:17)
  at Interface.<anonymous> (/usr/lib/coffeescript/repl.js:18:26)
  at Interface.emit (events:27:15)
  at Interface._ttyWrite (readline:309:12)
  at Interface.write (readline:147:30)
  at Stream.<anonymous> (/usr/lib/coffeescript/repl.js:35:17)
  at Stream.emit (events:27:15)

I tried to use '\' as a newline,but the same error was displayed.

coffee> kids = \
Error: In repl, Parse error on line 1: Unexpected '\'
  at Object.parseError (/usr/lib/coffeescript/parser.js:463:11)
  at Object.parse (/usr/lib/coffeescript/parser.js:533:22)
  at /usr/lib/coffeescript/coffee-script.js:26:22
  at Object.eval (/usr/lib/coffeescript/coffee-script.js:64:17)
  at Interface.<anonymous> (/usr/lib/coffeescript/repl.js:18:26)
  at Interface.emit (events:27:15)
  at Interface._ttyWrite (readline:309:12)
  at Interface.write (readline:147:30)
  at Stream.<anonymous> (/usr/lib/coffeescript/repl.js:35:17)
  at Stream.emit (events:27:15)

I can't use multiline, so I can't use indentation.

What should I do?

My environment is the following:

  • OS: Ubuntu 10.04 lucid

  • coffeescript version 1.0.0 I installed coffeescript with PPA and apt-get command.

see this url: https://launchpad.net/~gezakovacs/+archive/coffeescript

2
  • I highly recommend installing Node.js separately and then using npm install -g [email protected]. That way, you can easily install any version of CoffeeScript that you want and update to new versions as soon as they're available. May 8, 2012 at 14:50
  • Thank you for your comment. I changed the installation using ppa into using npm.
    – utwang
    May 8, 2012 at 15:36

2 Answers 2

118

You can also switch to multiline mode with Ctrl+V.

3
  • Ah, Ctrl-V rocks. Thanks
    – cpursley
    Oct 30, 2013 at 13:51
  • doesn't work...coffee> fill = (container, liquid = "coffee") -> "filling the #{container} with #{liquid}.." [Function] coffee> fill "cup" 'filling the cup with coffee..' ------> shit = (container, liquid = "coffee") -> ....... "filling the #{container} with #{liquid}.." ReferenceError: container is not defined Mar 27, 2014 at 9:56
  • I am using node with vscode on Windows and it's terminal eats my ctrl-v and fires the paste from clipboard event. So I changed the hardcoded 'v' at node_modules/coffee-script/lib/coffee-script/repl.js:91:73 to a 'b' Mar 18, 2019 at 9:35
1

backslash works fine with my coffee 1.2.1... try to upgrade :)

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.