Skip to content

Blocks with comments only throw ParseError #246

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

Closed
StanAngeloff opened this issue Mar 10, 2010 · 3 comments
Closed

Blocks with comments only throw ParseError #246

StanAngeloff opened this issue Mar 10, 2010 · 3 comments
Labels

Comments

@StanAngeloff
Copy link
Contributor

Run the following on coffeescript.org:

a: 1
if a
    # I don't like comments
else
    a: 2

It used to compile just fine, but on master it seems comments cannot be the only token in a block. May have something to do with how the rewriter is adjusting them? If you put a newline just before the comment, it will compile OK.

@jashkenas
Copy link
Owner

I was going to write a long explanation about how this doesn't work because comments don't affect indentation. But instead, I added a rule for TERMINATOR Commentwhich makes it so that an empty comment can be used as a valid Block in the grammar. Here's the passing test:

result: if false
  # comment
else
  27

ok result is 27

Closing the ticket.

@StanAngeloff
Copy link
Contributor Author

We don't say this often enough: Thank you.

@GeoffreyBooth
Copy link
Collaborator

This is fixed via #4572. Sorry it took awhile.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants