Skip to content

Instantly share code, notes, and snippets.

@FireNeslo
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FireNeslo/a11455ee7f76c1b7ab9a to your computer and use it in GitHub Desktop.
Save FireNeslo/a11455ee7f76c1b7ab9a to your computer and use it in GitHub Desktop.
browserify transform for ruby style symbols
var through = require('through2');
var symbols = /¤([^\s,:;()\[\]{}=]+)/g
function strings(string, match) {
return "'" + match + "'"
}
module.exports = function (file) {
return through(function (buffer, enc, next) {
var input = buffer.toString('utf8')
var output = input.replace(symbols, strings);
this.push(output)
next();
});
};
macro to_str {
case { _ ($toks ...) } => {
return [makeValue(#{ $toks ... }.map(unwrapSyntax).join(''), #{ here })];
}
}
operator (:) 14 { $key } => #{ to_str $key }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment