Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

Why 'Operators must be spaced properly &&'? #547

Closed
kongakong opened this issue Feb 10, 2016 · 2 comments
Closed

Why 'Operators must be spaced properly &&'? #547

kongakong opened this issue Feb 10, 2016 · 2 comments

Comments

@kongakong
Copy link

Here is the coffeescript code. The line that causes the exception is marked with ## <- Error at the end.

SAFETY_EXPANDER_TIMEOUT = 300#ms
...

      startExpandingAt = _.now()

      while @_someCondition()\
      and _.now() - startExpandingAt < SAFETY_EXPANDER_TIMEOUT  ## <- Error

Why it causes the exception 'Operators must be spaced properly &&? How can I fix it? I am using version 1.14.2

@AsaAyers
Copy link
Collaborator

This is the first example I've seen in coffeescript of using \ for a line continuation and putting the and on the next line. If you move your and to the previous line you won't need the \ for line continuation and it will fix this error.

while @_someCondition() and
_.now() - startExpandingAt < SAFETY_EXPANDER_TIMEOUT  ## <- Error

I'm not closing the issue because this still seems like a bug that could be addressed.

@swang
Copy link
Collaborator

swang commented Jun 10, 2016

Hmm I would have to say this is not an error. The backslash is right next to the right paren so it sucks up the next available tokens (and) right next to it so the lexer (and therefore linter) sees it as

while @_someCondition()and _.now()...

@swang swang closed this as completed Jun 10, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants