Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

inline coffeescript: parse error for regex with \n #677

metakeule opened this Issue Jun 19, 2012 · 3 comments


None yet
4 participants

this code

  regexp = /\n/


Error: new.jade:3 1| :coffeescript 2| regexp = /\n/ > 3| 4| Parse error on line 1: Unexpected 'MATH'

while this works:

  regexp = /\r/
  regexp2 = /\s/

bramsey commented Jul 9, 2012

This code seems to be the suspect. It looks like that line replaces escaped \n chars so coffee script's compiler can evaluate most code correctly, but \n chars within a regular expression should not be replaced and remain escaped. I've added a pull request for tests to reproduce the issue.

bramsey commented Jul 13, 2012

Thinking about this more, can line 93 simply be removed? It looks like coffeescript expects the string sent to compile to be escaped the way readFileSync() leaves the str. Is there another reason to unescape the new line characters that I'm not thinking about?


slang800 commented Oct 18, 2012

I tried removing the line you mentioned from my fork and I works perfectly (all the tests pass, including yours).

However, I cannot submit a pull request to get this modified because I've converted large chunks of my fork into coffee-script and made other changes to the syntax. Also, I can only make one fork per account and I already have a fork on slang800 and 2062 (the only other organization I have)... So can you add the fix to your existing pull request?

Edit: figured out how to submit it by making branches

@tj tj closed this in e5fe124 Nov 1, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment