Menu

#10 Coffeescript Syntax

Unstable_(example)
accepted
None
5
2016-11-02
2016-10-19
Jess Austin
No

I wrote a .lang file for coffeescript. Coffeescript is transpiled into javascript, similarly to typescript. coffee.lang nests two other .lang files, which handle the two types of regex we see in coffeescript. (The simpler one, js_regex.lang , might be used for js.lang as well?) I thought I'd be able to do something similarly fancy for string interpolation (i.e. nesting coffeescript in coffeescript strings), but I couldn't get that to work. Thanks!

3 Attachments

Discussion

  • André Simon

    André Simon - 2016-10-20

    Thanks a lot for this elaborate solution. I have never thought of defining the regex parts as nested language, will test this for Perl and other languages. I will check the coffeescript nesting issue, maybe this is prohibited.

     
  • André Simon

    André Simon - 2016-10-20
    • status: open --> accepted
    • assigned_to: André Simon
     
  • Jess Austin

    Jess Austin - 2016-10-20

    It's not so much that it's prohibited, but it's just that the rest of the string that isn't interpolation needs to be treated as a string rather than as a nesting delimiter. That is, "#{" only starts string interpolation when it's inside a string.

     
  • André Simon

    André Simon - 2016-10-28

    I updated the regex file to add character classes. The nested section code needs some more tweaks to be more flexible, for example allow other states as delimiters. Best solution would be to parse the delimiters in the old syntax, especially in HTML.

     
  • André Simon

    André Simon - 2016-11-02

    Release 3.33 contains Coffeescript. js_regex was not enabled for JS because of problems with terms like 1/2.

     

Log in to post a comment.