maxtaco / coffee-script

IcedCoffeeScript
http://maxtaco.github.com/coffee-script
MIT License
728 stars 58 forks source link

"#{1/2}/" parse error #169

Open vird opened 8 years ago

vird commented 8 years ago
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 }
zapu commented 8 years ago

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.

maxtaco commented 8 years ago

How about ICS version 3?

On Saturday, December 5, 2015, Michał Zochniak notifications@github.com 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 .

zapu commented 8 years ago

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

vird commented 8 years ago

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

zapu commented 8 years ago

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 commented 8 years ago

@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

vird commented 8 years ago

@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.