comparison jsbackend.js @ 9:37d7f60a8ea1

Allow use of tabletproglang programs in script tags
author Mike Pavone <pavone@retrodev.com>
date Wed, 21 Mar 2012 21:15:32 -0700
parents 04ae32e91598
children 02b20292f187
comparison
equal deleted inserted replaced
8:04ae32e91598 9:37d7f60a8ea1
44 floatlit.prototype.toJS = function(symbols) { 44 floatlit.prototype.toJS = function(symbols) {
45 return this.val.toString(); 45 return this.val.toString();
46 } 46 }
47 47
48 strlit.prototype.toJS = function(symbols) { 48 strlit.prototype.toJS = function(symbols) {
49 console.log('string:', this.val);
50 return '"' + this.val.replace('\\', '\\\\').replace('"', '\\"').replace('\n', '\\n').replace('\r', '\\r') + '"'; 49 return '"' + this.val.replace('\\', '\\\\').replace('"', '\\"').replace('\n', '\\n').replace('\r', '\\r') + '"';
51 } 50 }
52 51
53 funcall.prototype.toJS = function(symbols) { 52 funcall.prototype.toJS = function(symbols) {
54 var name = this.name[this.name.length-1] == ':' ? this.name.substr(0, this.name.length-1) : this.name; 53 var name = this.name[this.name.length-1] == ':' ? this.name.substr(0, this.name.length-1) : this.name;