I can't write multiline codes in Coffeescript Interactive Mode(REPL)

CoffeescriptMultilineInteractiveRead Eval-Print-Loop

Coffeescript Problem Overview


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

Coffeescript Solutions


Solution 1 - Coffeescript

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

Solution 2 - Coffeescript

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionutwangView Question on Stackoverflow
Solution 1 - CoffeescriptfulmicotonView Answer on Stackoverflow
Solution 2 - CoffeescriptalexView Answer on Stackoverflow