mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 19:42:50 -06:00
JavaScript lib: fixed bug where an integer was returned by print().
This commit is contained in:
@@ -66,15 +66,15 @@ Fun.prototype.isComplete = function() {
|
|||||||
|
|
||||||
/* Concrete syntax terms */
|
/* Concrete syntax terms */
|
||||||
|
|
||||||
function Arr() { this.values = copy_arguments(arguments, 0); }
|
function Arr() { this.arr = copy_arguments(arguments, 0); }
|
||||||
Arr.prototype.print = function() { return this.values[0].print(); };
|
Arr.prototype.print = function() { return this.arr[0].print(); };
|
||||||
Arr.prototype.sel = function(i) { return this.values[i.toIndex()]; };
|
Arr.prototype.sel = function(i) { return this.arr[i.toIndex()]; };
|
||||||
|
|
||||||
function Seq() { this.values = copy_arguments(arguments, 0); }
|
function Seq() { this.seq = copy_arguments(arguments, 0); }
|
||||||
Seq.prototype.print = function() { return join_print(this.values, " "); };
|
Seq.prototype.print = function() { return join_print(this.seq, " "); };
|
||||||
|
|
||||||
function Variants() { this.values = copy_arguments(arguments, 0); }
|
function Variants() { this.variants = copy_arguments(arguments, 0); }
|
||||||
Variants.prototype.print = function() { return /*join_print(this.values, "/");*/ this.values[0].print(); };
|
Variants.prototype.print = function() { return this.variants[0].print(); };
|
||||||
|
|
||||||
function Rp(index,value) { this.index = index; this.value = value; }
|
function Rp(index,value) { this.index = index; this.value = value; }
|
||||||
Rp.prototype.print = function() { return this.index; };
|
Rp.prototype.print = function() { return this.index; };
|
||||||
@@ -93,7 +93,7 @@ function Str(value) { this.value = value; }
|
|||||||
Str.prototype.print = function() { return this.value; };
|
Str.prototype.print = function() { return this.value; };
|
||||||
|
|
||||||
function Int(value) { this.value = value; }
|
function Int(value) { this.value = value; }
|
||||||
Int.prototype.print = function() { return this.value; };
|
Int.prototype.print = function() { return this.value.toString(); };
|
||||||
Int.prototype.toIndex = function() { return this.value; };
|
Int.prototype.toIndex = function() { return this.value; };
|
||||||
|
|
||||||
/* Type annotation */
|
/* Type annotation */
|
||||||
@@ -192,6 +192,7 @@ function isArray(a) { return a && typeof a == 'object' && a.constructor == Array
|
|||||||
function isUndefined(a) { return typeof a == 'undefined'; }
|
function isUndefined(a) { return typeof a == 'undefined'; }
|
||||||
function isBoolean(a) { return typeof a == 'boolean'; }
|
function isBoolean(a) { return typeof a == 'boolean'; }
|
||||||
function isNumber(a) { return typeof a == 'number' && isFinite(a); }
|
function isNumber(a) { return typeof a == 'number' && isFinite(a); }
|
||||||
|
function isFunction(a) { return typeof a == 'function'; }
|
||||||
|
|
||||||
function dumpObject (obj) {
|
function dumpObject (obj) {
|
||||||
if (isUndefined(obj)) {
|
if (isUndefined(obj)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user