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

Parsing fails if source contains multiline string #254

Open
murrayju opened this issue Jul 25, 2017 · 4 comments
Open

Parsing fails if source contains multiline string #254

murrayju opened this issue Jul 25, 2017 · 4 comments

Comments

@murrayju
Copy link

Coffeescript allows multiline strings. The codo parser throws an error if the source contains a multiline string with interpolation.

class Test
  constructor: (a, b) ->
    @thing = "#{a} >
      #{b}"

Gives the error:

error: Cannot parse Coffee file Test.coffee: missing "

The same code passes through the CoffeeScript compiler (and coffeelint) without error.

@timkinnane
Copy link

You could try with a multiline block instead

@thing = """
  #{a} >
    #{b}
"""

Not a solution to the parsing issue, but might let you move forward and is probably safer generally to use multiline blocks because it's more explicit and readable as opposed to the single quote method, which could easily be read as a mistake.

@murrayju
Copy link
Author

Those aren't equivalent though. The block form will include newline characters, while the other form joins lines with a single space character. The workaround is to put it on a single line, or concatenate multiple strings across lines.

This isn't blocking me, just annoying when valid coffee code fails to process through codo and I have to modify it.

@murrayju
Copy link
Author

This would also be way less annoying if codo would output the offending line number. These parse errors can be really hard to track down.

@timkinnane
Copy link

Of course, my bad.

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

No branches or pull requests

2 participants