Mercurial > repos > tabletprog
comparison interp.js @ 213:e00a8bc6361b
Implement match:yield macro
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 02 Dec 2013 00:50:16 -0800 |
parents | d0848563f25d |
children | adad61ea2f3a |
comparison
equal
deleted
inserted
replaced
212:32080f96c3a0 | 213:e00a8bc6361b |
---|---|
293 symbol.prototype.quote = function(env) { | 293 symbol.prototype.quote = function(env) { |
294 var val = env.find(this.name); | 294 var val = env.find(this.name); |
295 if (val) { | 295 if (val) { |
296 var newnode = makeASTNode(val); | 296 var newnode = makeASTNode(val); |
297 if (!(newnode instanceof symbol)) { | 297 if (!(newnode instanceof symbol)) { |
298 newnode = newnode.quote(env); | 298 if ('quote' in newnode) { |
299 newnode = newnode.quote(env); | |
300 } else { | |
301 throw new Error('Symbol ' + this.name + ' is not bound to a valid AST value, instead it is bound to an object with keys ' + JSON.stringify(Object.keys(newnode))); | |
302 } | |
299 } | 303 } |
300 return newnode; | 304 return newnode; |
301 } else { | 305 } else { |
302 var hygenic = env.findQuoteTrans(this.name); | 306 var hygenic = env.findQuoteTrans(this.name); |
303 return hygenic ? new symbol(hygenic, this.symbols) : this; | 307 return hygenic ? new symbol(hygenic, this.symbols) : this; |