s-ol’s avatars-ol’s Twitter Archive—№ 1,140

      1. @moonscript synthesizing moonscript 'string' AST nodes I had a bit of a hard time escaping strings. I ended up with this: escape_str = (str) -> (str\gsub('\\', '\\\\')\gsub '"', '\\"'), nil { 'string', '"', escape_str code } is this correct? is there a helper I missed?
    1. …in reply to @S0lll0s
      string.format '%q' didn't work because it adds surrounding quotes, and with those stripped away I still had some problems. Couldn't quite wrap my head around the way this string was going to be treated after in the compilation phase.
  1. …in reply to @S0lll0s
    semantically I would've preferred to use '[[' strings since I am pushing around multi-line Lua code here, but I could't figure those out at all.
    1. …in reply to @S0lll0s
      also I would love to get rid of this silly traversal function if there's a simple-ish way to get at the moonscript compiler hooks / transformation system that you mentioned before without forking moonscript itself. github.com/s-ol/mmm/blob/master/duct_tape.moon#L54-L60