Skip to content

Instantly share code, notes, and snippets.

@spencertipping
Created August 28, 2010 00:43
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 spencertipping/554455 to your computer and use it in GitHub Desktop.
Save spencertipping/554455 to your computer and use it in GitHub Desktop.
function () {var left_in = function (x, ops) {return x.xs && x.xs[0] && (ops[x.xs[0].op] && x.xs[0].op ||
x.xs[0].xs && x.xs[0].xs[1] && ops[x.xs[0].xs[1].op] && x.xs[0].xs[1].op)},
right_in = function (x, ops) {return x.xs && x.xs[1] && ops[x.xs[1].op] && x.xs[1].op},
$_ = '';
return '([{'.indexOf(this.op) > -1 ? this.op + s(this.xs[0]) + r.openers[this.op] :
this.op == '?' ? s(this.xs[0]) + ' ? ' + s(this.xs[1].xs[0]) + ' : ' + s(this.xs[2]) :
this.op == '(!' || this.op == '[!' ? s(this.xs[0]) + s(this.xs[1]) :
r.implicit_assignment[this.op] ? '(' + (this.op.charAt(0) === 'u' ? this.op.substring(1) + s(this.xs[0]) : s(this.xs[0]) + this.op) + ')' :
this.xs[1] && r.connected[this.xs[1].op] ? (($_ = s(this.xs[0])).charAt($_.length - 1) === '}' ? $_ + ' ' : $_ + ';') + s(this.xs[1]) :
r.unary[this.op] ? (r.translations[this.op] || this.op) + ' ' + s(this.xs[0]) :
r.prefix_binary[this.op] ? this.op + ' ' + s(this.xs[0]) + ' ' + s(this.xs[1]) :
r.no_spaces[this.op] ? s(this.xs[0]) + this.op + s(this.xs[1]) :
s(this.xs[0]) + ' ' + this.op + ' ' + s(this.xs[1])}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment