Trying to test for spaces in a string using a regex. Ran into unexpected math in an if block. Nice to see that the coffeescript lexer is annotated though: http://coffeescript.org/documentation/docs/lexer.html#section-14
» coffee --version
CoffeeScript version 1.4.0
» coffee
coffee> / /
Error: In repl, Parse error on line 1: Unexpected 'MATH'
at Object.parseError (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/parser.js:477:11)
at Object.parse (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/parser.js:554:22)
at /usr/local/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:47:20
at Object.eval (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:144:10)
at Interface.<anonymous> (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/repl.js:145:40)
at Interface.emit (events.js:67:17)
at Interface._onLine (readline.js:162:10)
at Interface._line (readline.js:426:8)
at Interface._ttyWrite (readline.js:603:14)
at ReadStream.<anonymous> (readline.js:82:12)
coffee> /[ ]/ # workaround
/[ ]/
» node
> / /
/ /
Apparently, /
can mean divides (Unexpected MATH) or the beginning of a regular expression. See How to read macros.
/[ ]/ worked for me. Thanks!