coffee-script icon indicating copy to clipboard operation
coffee-script copied to clipboard

"#{1/2}/" parse error

Open vird opened this issue 10 years ago • 7 comments

iced> "#{1/2}/"
[stdin]:1:1: error: missing ", starting
"#{a/2}/"
^

coffee> "#{1/2}/"
'0.5/'

Other 'fun' stuff

"""
#{a/2}/
"""

MISSING }, STARTING

"#{1/2});/}"

UNMATCHED }

vird avatar Nov 15 '15 17:11 vird

Looks like the lexer has changed a bit, and the strings are parsed differently now in CoffeeScript.

coffee -t -e "\"#{2}/\""
[STRING_START (] [( (] [NUMBER 2] [) )] [+ +] [STRING "/"] [STRING_END )] [TERMINATOR \n]

iced -t -e "\"#{1}/\""
[( (] [STRING ""] [+ +] [NUMBER 1] [+ +] [STRING "/"] [) )] [TERMINATOR \n]

I tried to swap grammar and lexer from latest CoffeeScript to IcedCoffeeScript but the changes are too significant for me to cherry pick things and apply.

zapu avatar Dec 05 '15 17:12 zapu

How about ICS version 3?

On Saturday, December 5, 2015, Michał Zochniak [email protected] wrote:

Looks like the lexer has changed a bit, and the strings are parsed differently now in CoffeeScript.

coffee -t -e ""#{2}/"" [STRING_START (] [( (] [NUMBER 2] [) )] [+ +] [STRING "/"] [STRING_END )] [TERMINATOR \n]

iced -t -e ""#{1}/"" [( (] [STRING ""] [+ +] [NUMBER 1] [+ +] [STRING "/"] [) )] [TERMINATOR \n]

I tried to swap grammar and lexer from latest CoffeeScript to IcedCoffeeScript but the changes are too significant for me to cherry pick things and apply.

— Reply to this email directly or view it on GitHub https://github.com/maxtaco/coffee-script/issues/169#issuecomment-162224922 .

maxtaco avatar Dec 05 '15 17:12 maxtaco

iced3 is already on the new grammar/lexer so it works there.

zapu avatar Dec 05 '15 17:12 zapu

iced -v IcedCoffeeScript version 108.0.9 still reproduced. Where can i find iced3?

vird avatar Dec 05 '15 18:12 vird

It is still work in progress, unfortunately. You can follow this PR if you are interested: https://github.com/maxtaco/coffee-script/pull/168

zapu avatar Dec 05 '15 19:12 zapu

@vird may I ask what's your use case? Would you be able to test new iced3, even by just installing it in test environment and running your application's test suite against it? Thanks

zapu avatar Dec 06 '15 13:12 zapu

@zapu I use iced for generating opencl kernels source code. So I have code something like this

code = """
  int offset = size_x + #{other_offset/2}; // comment
  """

btw. What's a proper method for install iced3? I download branch. I can use ./bin/coffee but i don't know how to install globally.

vird avatar Dec 06 '15 19:12 vird