Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trailing backslashes in strings #1273

Closed
satyr opened this issue Apr 9, 2011 · 6 comments · Fixed by #3261
Closed

trailing backslashes in strings #1273

satyr opened this issue Apr 9, 2011 · 6 comments · Fixed by #3261
Labels

Comments

@satyr
Copy link
Collaborator

satyr commented Apr 9, 2011

$ coffee -s
'\
'
Error: Parse error on line 1: Unexpected '''
...

$ coffee -s
"\
"

.:2
  "\";
  ^^^^
SyntaxError: Unexpected token ILLEGAL
...

$ coffee -s
'''\
'''

.:2
  '\';
  ^^^^
SyntaxError: Unexpected token ILLEGAL
...

$ coffee -s
"""\
"""
Error: missing ", starting on line 2
...
@michaelficarra
Copy link
Collaborator

What is

"\
"

supposed to compile to? My guess would be "\n".

edit: Actually, considering that the same syntax is allowed with single quotes, I am going to guess "". Also, the code in lexer.coffee seems to be supporting that idea. And so do the tests.

@ejones
Copy link

ejones commented Apr 10, 2011

See #647 ... where you classified these as syntax errors...

@satyr
Copy link
Collaborator Author

satyr commented Apr 10, 2011

See #647 ... where you classified these as syntax errors

Looks like it has regressed since then.

$ git checkout ae55c70
HEAD is now at ae55c70... 647: fixed quote/newline escaping in here documents

$ bin/coffee -pe --no-wrap '"""\"""'
"\"";

Weird, but valid. As for now:

$ git checkout 1.0.1
HEAD is now at c44d9ae... CoffeeScript 1.0.1

$ bin/coffee -bpe '"""\"""'
"\";

@michaelficarra
Copy link
Collaborator

This one needs more discussion about expected behaviour. Flagging as notice.

@marchaefner
Copy link
Collaborator

With the current changes #3246 and #3256 all cases of the OP should compile to empty strings. Pinging @xixixao...

@xixixao
Copy link
Contributor

xixixao commented Nov 26, 2013

Broken on master, let me fix it.

marchaefner pushed a commit that referenced this issue Nov 28, 2013
Fix #1273, Handle backslashes at the end of heredocs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants