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

utwang picture utwang · May 8, 2012 · Viewed 8.4k times · Source

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

Answer

fulmicoton picture fulmicoton · Jan 26, 2013

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