implement Ecmascript; include "sys.m";include "math.m";include "string.m";include "daytime.m";include "ecmascript.m"; include "pprint.b";include "obj.b";include "exec.b";include "date.b";include "builtin.b";include "regexp.b";include "uri.b"; FF: con '\u000c';LS: con '\u2028';PS: con '\u2029'; islt(c: int): int{ return c == '\n' || c == '\r' || c == LS || c == PS;} me: ESHostobj; sys: Sys;print, sprint: import sys;stdout: ref Sys->FD; math: Math; isnan, floor, copysign, fabs, fmod, NaN, Infinity: import math; str: String; daytime: Daytime; Tm: import daytime; labrec: adt{ s: string; # name k: int; # kind}; HashSize: con 1024; Parser: adt{ ex: ref Exec; code: ref Code; inloop: int; # parser state incase: int; infunc: int; lastnl: int; # parser state for inserting ; notin: int; # don't allow `in' in expression token: int; # lexical token token1: int; # lexical token id: int; # associated value lineno: int; src: string; # lexical input state esrc: int; srci: int; errors: int; labs: list of ref labrec;}; Keywd: adt{ name: string; token: int;}; ## lexical tokens and ops# Lbase: con 128; Leos, Landas, Loras, Lxoras, Llshas, Lrshas, Lrshuas, Laddas, Lsubas, Lmulas, Ldivas, Lmodas, Loror, Landand, Leq, Lneq, Lleq, Lgeq, Llsh, Lrsh, Lrshu, Linc, Ldec, Lnum, Lid, Lstr, Lthis, Ltypeof, Ldelete, Lvoid, Lwhile, Lfor, Lbreak, Lcontinue, Lwith, Lreturn, Lfunction, Lvar, Lif, Lelse, Lin, Lnew, Lcase, Ldefault, Lswitch, Ldo, Linstanceof, Lcatch, Lfinally, Lthrow, Ltry, Lregexp, Lseq, Lsne, Lprint, Lpostinc, # ops that aren't lexical tokens Lpostdec, Lpresub, Lpreadd, Lcall, Lnewcall, Lgetval, Las, Lasop, Lforin, Lforvar, Lforvarin, Larrinit, Lobjinit, Lnoval, Llabel, Lbreaklab, Lcontinuelab, # # reserved words # Labstract, Lboolean, Lbyte, Lchar, Lclass, Lconst, Ldebugger, Ldouble, Lenum, Lexport, Lextends, Lfinal, Lfloat, Lgoto, Limplements, Limport, Lint, Linterface, Llong, Lnative, Lpackage, Lprivate, Lprotected, Lpublic, Lshort, Lstatic, Lsuper, Lsynchronized, Lthrows, Ltransient, Lvolatile: con Lbase + iota; ## internals# Mlower, Mupper, Munder, Mdigit, Msign, Mexp, Mhex, Moct: con byte 1 << iota;Malpha: con Mupper|Mlower|Munder;map := array[256] of { '_' or '$' => Munder, '-' or '+' => Msign, 'a' to 'd' or 'f' => Mlower | Mhex, 'e' => Mlower | Mhex | Mexp, 'g' to 'z' => Mlower, 'A' to 'D' or 'F' => Mupper | Mhex, 'E' => Mupper | Mhex | Mexp, 'G' to 'Z' => Mupper, '0' to '7' => Mdigit | Mhex | Moct, '8' to '9' => Mdigit | Mhex, * => byte 0}; maxerr: int;toterrors: int;fabort: int; escmap := array[] of{ '\'' => byte '\'', '"' => byte '"', '\\' => byte '\\', 'b' => byte '\b', 'f' => byte FF, 'n' => byte '\n', 'r' => byte '\r', 't' => byte '\t', 'v' => byte FF, * => byte 255}; ## must be sorted#keywords := array [] of{ Keywd("abstract", Labstract), Keywd("boolean", Lboolean), Keywd("byte", Lbyte), Keywd("break", Lbreak), Keywd("case", Lcase), Keywd("catch", Lcatch), Keywd("char", Lchar), Keywd("class", Lclass), Keywd("const", Lconst), Keywd("continue", Lcontinue), Keywd("debugger", Ldebugger), Keywd("default", Ldefault), Keywd("delete", Ldelete), Keywd("do", Ldo), Keywd("double", Ldouble), Keywd("else", Lelse), Keywd("enum", Lenum), Keywd("export", Lexport), Keywd("extends ", Lextends), Keywd("final", Lfinal), Keywd("finally", Lfinally), Keywd("float", Lfloat), Keywd("for", Lfor), Keywd("function", Lfunction), Keywd("goto", Lgoto), Keywd("if", Lif), Keywd("implements", Limplements), Keywd("import", Limport), Keywd("in", Lin), Keywd("instanceof", Linstanceof), Keywd("int", Lint), Keywd("interface", Linterface), Keywd("long", Llong), Keywd("native", Lnative), Keywd("new", Lnew), Keywd("package", Lpackage), # Keywd("print", Lprint), Keywd("private", Lprivate), Keywd("protected", Lprotected), Keywd("public", Lpublic), Keywd("return", Lreturn), Keywd("short", Lshort), Keywd("static", Lstatic), Keywd("super", Lsuper), Keywd("switch", Lswitch), Keywd("synchronized", Lsynchronized), Keywd("this", Lthis), Keywd("throw", Lthrow), Keywd("throws", Lthrows), Keywd("transient", Ltransient), Keywd("try", Ltry), Keywd("typeof", Ltypeof), Keywd("var", Lvar), Keywd("void", Lvoid), Keywd("volatile", Lvolatile), Keywd("while", Lwhile), Keywd("with", Lwith),}; debug = array[256] of {* => 0}; glbuiltins := array[] of{ Builtin("eval", "eval", array[] of {"src"}, 1), Builtin("parseInt", "parseInt", array[] of {"string", "radix"}, 2), Builtin("parseFloat", "parseFloat", array[] of {"string"}, 1), Builtin("escape", "escape", array[] of {"string"}, 1), Builtin("unescape", "unescape", array[] of {"string"}, 1), Builtin("isNaN", "isNaN", array[] of {"number"}, 1), Builtin("isFinite", "isFinite", array[] of {"number"}, 1), Builtin("decodeURI", "decodeURI", array[] of {"string"}, 1), Builtin("decodeURIComponent", "decodeURIComponent", array[] of {"string"}, 1), Builtin("encodeURI", "encodeURI", array[] of {"string"}, 1), Builtin("encodeURIComponent", "encodeURIComponent", array[] of {"string"}, 1),}; biobj := Builtin("Object", "Object", array[] of {"value"}, 1);biobjproto := array[] of{ Builtin("toString", "Object.prototype.toString", nil, 0), Builtin("toLocaleString", "Object.prototype.toLocaleString", nil, 0), Builtin("valueOf", "Object.prototype.valueOf", nil, 0), Builtin("hasOwnProperty", "Object.prototype.hasOwnProperty", array[] of {"V"}, 1), Builtin("isPrototypeOf", "Object.prototype.isPrototypeOf", array[] of {"V"}, 1), Builtin("propertyisEnumerable", "Object.prototype.propertyisEnumerable", array[] of {"V"}, 1),}; bifunc := Builtin("Function", "Function", array[] of {"body"}, 1);bifuncproto := array[] of{ Builtin("toString", "Function.prototype.toString", nil, 0), Builtin("apply", "Function.prototype.apply", array[] of {"this", "array"}, 2), Builtin("call", "Function.prototype.call", array[] of {"this", "arg"}, 1),}; bierr := Builtin("Error", "Error", array[] of {"message"}, 1);bierrproto := array[] of{ Builtin("toString", "Error.prototype.toString", nil , 0),}; biarray := Builtin("Array", "Array", array[] of {"length"}, 1);biarrayproto := array[] of{ Builtin("toString", "Array.prototype.toString", nil, 0), Builtin("toLocaleString", "Array.prototype.toLocaleString", nil, 0), Builtin("concat", "Array.prototype.concat", array[] of {"item"}, 1), Builtin("join", "Array.prototype.join", array[] of {"separator"}, 1), Builtin("pop", "Array.prototype.pop", nil, 0), Builtin("push", "Array.prototype.push", array[] of {"item"} , 1), Builtin("reverse", "Array.prototype.reverse", nil, 0), Builtin("shift", "Array.prototype.shift", nil, 0), Builtin("slice", "Array.prototype.slice", array[] of {"start", "end"}, 2), Builtin("splice", "Array.prototype.splice", array[] of {"start", "delcnt", "item"}, 2), Builtin("sort", "Array.prototype.sort", array[] of {"comparefunc"}, 1), Builtin("unshift", "Array.prototype.unshift", array[] of {"item"}, 1),}; bistr := Builtin("String", "String", array[] of {"value"}, 1);bistrproto := array[] of{ Builtin("toString", "String.prototype.toString", nil, 0), Builtin("valueOf", "String.prototype.valueOf", nil, 0), Builtin("charAt", "String.prototype.charAt", array[] of {"pos"}, 1), Builtin("charCodeAt", "String.prototype.charCodeAt", array[] of {"pos"}, 1), Builtin("concat", "String.prototype.concat", array[] of {"string"}, 1), Builtin("indexOf", "String.prototype.indexOf", array[] of {"string", "pos"}, 2), Builtin("lastIndexOf", "String.prototype.lastIndexOf", array[] of {"string", "pos"}, 2), Builtin("localeCompare", "String.prototype.localeCompare", array[] of {"that"}, 1), Builtin("slice", "String.prototype.slice", array[] of {"start", "end"}, 2), Builtin("split", "String.prototype.split", array[] of {"separator"}, 2), Builtin("substr", "String.prototype.substr", array[] of {"start", "length"}, 2), Builtin("substring", "String.prototype.substring", array[] of {"start", "end"}, 2), Builtin("toLowerCase", "String.prototype.toLowerCase", nil, 0), Builtin("toUpperCase", "String.prototype.toUpperCase", nil, 0), Builtin("toLocaleLowerCase", "String.prototype.toLocaleLowerCase", nil, 0), Builtin("toLocaleUpperCase", "String.prototype.toLocaleUpperCase", nil, 0),# JavaScript 1.0 Builtin("anchor", "String.prototype.anchor", array[] of {"name"}, 1), Builtin("big", "String.prototype.big", nil, 0), Builtin("blink", "String.prototype.blink", nil, 0), Builtin("bold", "String.prototype.bold", nil, 0), Builtin("fixed", "String.prototype.fixed", nil, 0), Builtin("fontcolor", "String.prototype.fontcolor", array[] of {"color"}, 1), Builtin("fontsize", "String.prototype.fontsize", array[] of {"size"}, 1), Builtin("italics", "String.prototype.italics", nil, 0), Builtin("link", "String.prototype.link", array[] of {"href"}, 1), Builtin("small", "String.prototype.small", nil, 0), Builtin("strike", "String.prototype.strike", nil, 0), Builtin("sub", "String.prototype.sub", nil, 0), Builtin("sup", "String.prototype.sup", nil, 0), Builtin("match", "String.prototype.match", array[] of {"regexp"}, 1), Builtin("replace", "String.prototype.replace", array[] of {"searchval", "replaceval"}, 2), Builtin("search", "String.prototype.search", array[] of {"regexp"}, 1),};bistrctor := Builtin("fromCharCode", "String.fromCharCode", array[] of {"characters"}, 1); bibool := Builtin("Boolean", "Boolean", array[] of {"value"}, 1);biboolproto := array[] of{ Builtin("toString", "Boolean.prototype.toString", nil, 0), Builtin("valueOf", "Boolean.prototype.valueOf", nil, 0),}; binum := Builtin("Number", "Number", array[] of {"value"}, 1);binumproto := array[] of{ Builtin("toString", "Number.prototype.toString", nil, 0), Builtin("toLocaleString", "Number.prototype.toLocaleString", nil, 0), Builtin("valueOf", "Number.prototype.valueOf", nil, 0), Builtin("toFixed", "Number.prototype.toFixed", array[] of {"digits"}, 1), Builtin("toExponential", "Number.prototype.toExponential", array[] of {"digits"}, 1), Builtin("toPrecision", "Number.prototype.toPrecision", array[] of {"digits"}, 1),}; biregexp := Builtin("RegExp", "RegExp", array[] of {"pattern", "flags"}, 2);biregexpproto := array[] of{ Builtin("exec", "RegExp.prototype.exec", array[] of {"string"}, 1), Builtin("test", "RegExp.prototype.test", array[] of {"string"}, 1), Builtin("toString", "RegExp.prototype.toString", nil, 0),}; bidate := Builtin("Date", "Date", array[] of {"value"}, 1);bidateproto := array[] of{ Builtin("toString", "Date.prototype.toString", nil, 0), Builtin("toDateString", "Date.prototype.toDateString", nil, 0), Builtin("toTimeString", "Date.prototype.toTimeString", nil, 0), Builtin("toLocaleString", "Date.prototype.toLocalString", nil, 0), Builtin("toLocaleDateString", "Date.prototype.toLocaleDateString", nil, 0), Builtin("toLocaleTimeString", "Date.prototype.toLocaleTimeString", nil, 0), Builtin("valueOf", "Date.prototype.valueOf", nil, 0), Builtin("getTime", "Date.prototype.getTime", nil, 0), Builtin("getYear", "Date.prototype.getYear", nil, 0), Builtin("getFullYear", "Date.prototype.getFullYear", nil, 0), Builtin("getUTCFullYear", "Date.prototype.getUTCFullYear", nil, 0), Builtin("getMonth", "Date.prototype.getMonth", nil, 0), Builtin("getUTCMonth", "Date.prototype.getUTCMonth", nil, 0), Builtin("getDate", "Date.prototype.getDate", nil, 0), Builtin("getUTCDate", "Date.prototype.getUTCDate", nil, 0), Builtin("getDay", "Date.prototype.getDay", nil, 0), Builtin("getUTCDay", "Date.prototype.getUTCDay", nil, 0), Builtin("getHours", "Date.prototype.getHours", nil, 0), Builtin("getUTCHours", "Date.prototype.getUTCHours", nil, 0), Builtin("getMinutes", "Date.prototype.getMinutes", nil, 0), Builtin("getUTCMinutes", "Date.prototype.getUTCMinutes", nil, 0), Builtin("getSeconds", "Date.prototype.getSeconds", nil, 0), Builtin("getUTCSeconds", "Date.prototype.getUTCSeconds", nil, 0), Builtin("getMilliseconds", "Date.prototype.getMilliseconds", nil, 0), Builtin("getUTCMilliseconds", "Date.prototype.getUTCMilliseconds", nil, 0), Builtin("getTimezoneOffset", "Date.prototype.getTimezoneOffset", nil, 0), Builtin("setTime", "Date.prototype.setTime", array[] of {"time"}, 1), Builtin("setMilliseconds", "Date.prototype.setMilliseconds", array[] of {"ms"}, 1), Builtin("setUTCMilliseconds", "Date.prototype.setUTCMilliseconds", array[] of {"ms"}, 1), Builtin("setSeconds", "Date.prototype.setSeconds", array[] of {"sec", "ms"}, 2), Builtin("setUTCSeconds", "Date.prototype.setUTCSeconds", array[] of {"sec", "ms"}, 2), Builtin("setMinutes", "Date.prototype.setMinutes", array[] of {"min", "sec", "ms"}, 3), Builtin("setUTCMinutes", "Date.prototype.setUTCMinutes", array[] of {"min", "sec", "ms"}, 3), Builtin("setHours", "Date.prototype.setHours", array[] of {"hour", "min", "sec", "ms"}, 4), Builtin("setUTCHours", "Date.prototype.setUTCHours", array[] of {"hour", "min", "sec", "ms"}, 4), Builtin("setDate", "Date.prototype.setDate", array[] of {"date"}, 1), Builtin("setUTCDate", "Date.prototype.setUTCDate", array[] of {"date"}, 1), Builtin("setMonth", "Date.prototype.setMonth", array[] of {"mon", "date"}, 2), Builtin("setUTCMonth", "Date.prototype.setUTCMonth", array[] of {"mon", "date"}, 2), Builtin("setFullYear", "Date.prototype.setFullYear", array[] of {"year", "mon", "date"}, 3), Builtin("setUTCFullYear", "Date.prototype.setUTCFullYear", array[] of {"year", "mon", "date"}, 3), Builtin("setYear", "Date.prototype.setYear", array[] of {"year"}, 1), Builtin("toLocaleString", "Date.prototype.toLocaleString", nil, 0), Builtin("toUTCString", "Date.prototype.toUTCString", nil, 0), Builtin("toGMTString", "Date.prototype.toGMTString", nil, 0),};bidatector := array[] of{ Builtin("parse", "Date.parse", array[] of {"string"}, 1), Builtin("UTC", "Date.UTC", array[] of {"year", "month", "date", "hours", "minutes", "seconds", "ms"}, 7),}; bimath := array[] of{ Builtin("abs", "Math.abs", array[] of {"x"}, 1), Builtin("acos", "Math.acos", array[] of {"x"}, 1), Builtin("asin", "Math.asin", array[] of {"x"}, 1), Builtin("atan", "Math.atan", array[] of {"x"}, 1), Builtin("atan2", "Math.atan2", array[] of {"y", "x"}, 2), Builtin("ceil", "Math.ceil", array[] of {"x"}, 1), Builtin("cos", "Math.cos", array[] of {"x"}, 1), Builtin("exp", "Math.exp", array[] of {"x"}, 1), Builtin("floor", "Math.floor", array[] of {"x"}, 1), Builtin("log", "Math.log", array[] of {"x"}, 1), Builtin("max", "Math.max", array[] of {"x", "y"}, 2), Builtin("min", "Math.min", array[] of {"x", "y"}, 2), Builtin("pow", "Math.pow", array[] of {"x", "y"}, 2), Builtin("random", "Math.random", nil, 0), Builtin("round", "Math.round", array[] of {"x"}, 1), Builtin("sin", "Math.sin", array[] of {"x"}, 1), Builtin("sqrt", "Math.sqrt", array[] of {"x"}, 1), Builtin("tan", "Math.tan", array[] of {"x"}, 1),}; init(): stringLines 1–500 of 2626. Load more
implement Ecmascript; include "sys.m"; include "math.m"; include "string.m"; include "daytime.m"; include "ecmascript.m"; include "pprint.b"; include "obj.b"; include "exec.b"; include "date.b"; include "builtin.b"; include "regexp.b"; include "uri.b"; FF: con '\u000c'; LS: con '\u2028'; PS: con '\u2029'; islt(c: int): int { return c == '\n' || c == '\r' || c == LS || c == PS; } me: ESHostobj; sys: Sys; print, sprint: import sys; stdout: ref Sys->FD; math: Math; isnan, floor, copysign, fabs, fmod, NaN, Infinity: import math; str: String; daytime: Daytime; Tm: import daytime; labrec: adt{ s: string; # name k: int; # kind }; HashSize: con 1024; Parser: adt { ex: ref Exec; code: ref Code; inloop: int; # parser state incase: int; infunc: int; lastnl: int; # parser state for inserting ; notin: int; # don't allow `in' in expression token: int; # lexical token token1: int; # lexical token id: int; # associated value lineno: int; src: string; # lexical input state esrc: int; srci: int; errors: int; labs: list of ref labrec; }; Keywd: adt { name: string; token: int; }; # # lexical tokens and ops # Lbase: con 128; Leos, Landas, Loras, Lxoras, Llshas, Lrshas, Lrshuas, Laddas, Lsubas, Lmulas, Ldivas, Lmodas, Loror, Landand, Leq, Lneq, Lleq, Lgeq, Llsh, Lrsh, Lrshu, Linc, Ldec, Lnum, Lid, Lstr, Lthis, Ltypeof, Ldelete, Lvoid, Lwhile, Lfor, Lbreak, Lcontinue, Lwith, Lreturn, Lfunction, Lvar, Lif, Lelse, Lin, Lnew, Lcase, Ldefault, Lswitch, Ldo, Linstanceof, Lcatch, Lfinally, Lthrow, Ltry, Lregexp, Lseq, Lsne, Lprint, Lpostinc, # ops that aren't lexical tokens Lpostdec, Lpresub, Lpreadd, Lcall, Lnewcall, Lgetval, Las, Lasop, Lforin, Lforvar, Lforvarin, Larrinit, Lobjinit, Lnoval, Llabel, Lbreaklab, Lcontinuelab, # # reserved words # Labstract, Lboolean, Lbyte, Lchar, Lclass, Lconst, Ldebugger, Ldouble, Lenum, Lexport, Lextends, Lfinal, Lfloat, Lgoto, Limplements, Limport, Lint, Linterface, Llong, Lnative, Lpackage, Lprivate, Lprotected, Lpublic, Lshort, Lstatic, Lsuper, Lsynchronized, Lthrows, Ltransient, Lvolatile: con Lbase + iota; # # internals # Mlower, Mupper, Munder, Mdigit, Msign, Mexp, Mhex, Moct: con byte 1 << iota; Malpha: con Mupper|Mlower|Munder; map := array[256] of { '_' or '$' => Munder, '-' or '+' => Msign, 'a' to 'd' or 'f' => Mlower | Mhex, 'e' => Mlower | Mhex | Mexp, 'g' to 'z' => Mlower, 'A' to 'D' or 'F' => Mupper | Mhex, 'E' => Mupper | Mhex | Mexp, 'G' to 'Z' => Mupper, '0' to '7' => Mdigit | Mhex | Moct, '8' to '9' => Mdigit | Mhex, * => byte 0 }; maxerr: int; toterrors: int; fabort: int; escmap := array[] of { '\'' => byte '\'', '"' => byte '"', '\\' => byte '\\', 'b' => byte '\b', 'f' => byte FF, 'n' => byte '\n', 'r' => byte '\r', 't' => byte '\t', 'v' => byte FF, * => byte 255 }; # # must be sorted # keywords := array [] of { Keywd("abstract", Labstract), Keywd("boolean", Lboolean), Keywd("byte", Lbyte), Keywd("break", Lbreak), Keywd("case", Lcase), Keywd("catch", Lcatch), Keywd("char", Lchar), Keywd("class", Lclass), Keywd("const", Lconst), Keywd("continue", Lcontinue), Keywd("debugger", Ldebugger), Keywd("default", Ldefault), Keywd("delete", Ldelete), Keywd("do", Ldo), Keywd("double", Ldouble), Keywd("else", Lelse), Keywd("enum", Lenum), Keywd("export", Lexport), Keywd("extends ", Lextends), Keywd("final", Lfinal), Keywd("finally", Lfinally), Keywd("float", Lfloat), Keywd("for", Lfor), Keywd("function", Lfunction), Keywd("goto", Lgoto), Keywd("if", Lif), Keywd("implements", Limplements), Keywd("import", Limport), Keywd("in", Lin), Keywd("instanceof", Linstanceof), Keywd("int", Lint), Keywd("interface", Linterface), Keywd("long", Llong), Keywd("native", Lnative), Keywd("new", Lnew), Keywd("package", Lpackage), # Keywd("print", Lprint), Keywd("private", Lprivate), Keywd("protected", Lprotected), Keywd("public", Lpublic), Keywd("return", Lreturn), Keywd("short", Lshort), Keywd("static", Lstatic), Keywd("super", Lsuper), Keywd("switch", Lswitch), Keywd("synchronized", Lsynchronized), Keywd("this", Lthis), Keywd("throw", Lthrow), Keywd("throws", Lthrows), Keywd("transient", Ltransient), Keywd("try", Ltry), Keywd("typeof", Ltypeof), Keywd("var", Lvar), Keywd("void", Lvoid), Keywd("volatile", Lvolatile), Keywd("while", Lwhile), Keywd("with", Lwith), }; debug = array[256] of {* => 0}; glbuiltins := array[] of { Builtin("eval", "eval", array[] of {"src"}, 1), Builtin("parseInt", "parseInt", array[] of {"string", "radix"}, 2), Builtin("parseFloat", "parseFloat", array[] of {"string"}, 1), Builtin("escape", "escape", array[] of {"string"}, 1), Builtin("unescape", "unescape", array[] of {"string"}, 1), Builtin("isNaN", "isNaN", array[] of {"number"}, 1), Builtin("isFinite", "isFinite", array[] of {"number"}, 1), Builtin("decodeURI", "decodeURI", array[] of {"string"}, 1), Builtin("decodeURIComponent", "decodeURIComponent", array[] of {"string"}, 1), Builtin("encodeURI", "encodeURI", array[] of {"string"}, 1), Builtin("encodeURIComponent", "encodeURIComponent", array[] of {"string"}, 1), }; biobj := Builtin("Object", "Object", array[] of {"value"}, 1); biobjproto := array[] of { Builtin("toString", "Object.prototype.toString", nil, 0), Builtin("toLocaleString", "Object.prototype.toLocaleString", nil, 0), Builtin("valueOf", "Object.prototype.valueOf", nil, 0), Builtin("hasOwnProperty", "Object.prototype.hasOwnProperty", array[] of {"V"}, 1), Builtin("isPrototypeOf", "Object.prototype.isPrototypeOf", array[] of {"V"}, 1), Builtin("propertyisEnumerable", "Object.prototype.propertyisEnumerable", array[] of {"V"}, 1), }; bifunc := Builtin("Function", "Function", array[] of {"body"}, 1); bifuncproto := array[] of { Builtin("toString", "Function.prototype.toString", nil, 0), Builtin("apply", "Function.prototype.apply", array[] of {"this", "array"}, 2), Builtin("call", "Function.prototype.call", array[] of {"this", "arg"}, 1), }; bierr := Builtin("Error", "Error", array[] of {"message"}, 1); bierrproto := array[] of { Builtin("toString", "Error.prototype.toString", nil , 0), }; biarray := Builtin("Array", "Array", array[] of {"length"}, 1); biarrayproto := array[] of { Builtin("toString", "Array.prototype.toString", nil, 0), Builtin("toLocaleString", "Array.prototype.toLocaleString", nil, 0), Builtin("concat", "Array.prototype.concat", array[] of {"item"}, 1), Builtin("join", "Array.prototype.join", array[] of {"separator"}, 1), Builtin("pop", "Array.prototype.pop", nil, 0), Builtin("push", "Array.prototype.push", array[] of {"item"} , 1), Builtin("reverse", "Array.prototype.reverse", nil, 0), Builtin("shift", "Array.prototype.shift", nil, 0), Builtin("slice", "Array.prototype.slice", array[] of {"start", "end"}, 2), Builtin("splice", "Array.prototype.splice", array[] of {"start", "delcnt", "item"}, 2), Builtin("sort", "Array.prototype.sort", array[] of {"comparefunc"}, 1), Builtin("unshift", "Array.prototype.unshift", array[] of {"item"}, 1), }; bistr := Builtin("String", "String", array[] of {"value"}, 1); bistrproto := array[] of { Builtin("toString", "String.prototype.toString", nil, 0), Builtin("valueOf", "String.prototype.valueOf", nil, 0), Builtin("charAt", "String.prototype.charAt", array[] of {"pos"}, 1), Builtin("charCodeAt", "String.prototype.charCodeAt", array[] of {"pos"}, 1), Builtin("concat", "String.prototype.concat", array[] of {"string"}, 1), Builtin("indexOf", "String.prototype.indexOf", array[] of {"string", "pos"}, 2), Builtin("lastIndexOf", "String.prototype.lastIndexOf", array[] of {"string", "pos"}, 2), Builtin("localeCompare", "String.prototype.localeCompare", array[] of {"that"}, 1), Builtin("slice", "String.prototype.slice", array[] of {"start", "end"}, 2), Builtin("split", "String.prototype.split", array[] of {"separator"}, 2), Builtin("substr", "String.prototype.substr", array[] of {"start", "length"}, 2), Builtin("substring", "String.prototype.substring", array[] of {"start", "end"}, 2), Builtin("toLowerCase", "String.prototype.toLowerCase", nil, 0), Builtin("toUpperCase", "String.prototype.toUpperCase", nil, 0), Builtin("toLocaleLowerCase", "String.prototype.toLocaleLowerCase", nil, 0), Builtin("toLocaleUpperCase", "String.prototype.toLocaleUpperCase", nil, 0), # JavaScript 1.0 Builtin("anchor", "String.prototype.anchor", array[] of {"name"}, 1), Builtin("big", "String.prototype.big", nil, 0), Builtin("blink", "String.prototype.blink", nil, 0), Builtin("bold", "String.prototype.bold", nil, 0), Builtin("fixed", "String.prototype.fixed", nil, 0), Builtin("fontcolor", "String.prototype.fontcolor", array[] of {"color"}, 1), Builtin("fontsize", "String.prototype.fontsize", array[] of {"size"}, 1), Builtin("italics", "String.prototype.italics", nil, 0), Builtin("link", "String.prototype.link", array[] of {"href"}, 1), Builtin("small", "String.prototype.small", nil, 0), Builtin("strike", "String.prototype.strike", nil, 0), Builtin("sub", "String.prototype.sub", nil, 0), Builtin("sup", "String.prototype.sup", nil, 0), Builtin("match", "String.prototype.match", array[] of {"regexp"}, 1), Builtin("replace", "String.prototype.replace", array[] of {"searchval", "replaceval"}, 2), Builtin("search", "String.prototype.search", array[] of {"regexp"}, 1), }; bistrctor := Builtin("fromCharCode", "String.fromCharCode", array[] of {"characters"}, 1); bibool := Builtin("Boolean", "Boolean", array[] of {"value"}, 1); biboolproto := array[] of { Builtin("toString", "Boolean.prototype.toString", nil, 0), Builtin("valueOf", "Boolean.prototype.valueOf", nil, 0), }; binum := Builtin("Number", "Number", array[] of {"value"}, 1); binumproto := array[] of { Builtin("toString", "Number.prototype.toString", nil, 0), Builtin("toLocaleString", "Number.prototype.toLocaleString", nil, 0), Builtin("valueOf", "Number.prototype.valueOf", nil, 0), Builtin("toFixed", "Number.prototype.toFixed", array[] of {"digits"}, 1), Builtin("toExponential", "Number.prototype.toExponential", array[] of {"digits"}, 1), Builtin("toPrecision", "Number.prototype.toPrecision", array[] of {"digits"}, 1), }; biregexp := Builtin("RegExp", "RegExp", array[] of {"pattern", "flags"}, 2); biregexpproto := array[] of { Builtin("exec", "RegExp.prototype.exec", array[] of {"string"}, 1), Builtin("test", "RegExp.prototype.test", array[] of {"string"}, 1), Builtin("toString", "RegExp.prototype.toString", nil, 0), }; bidate := Builtin("Date", "Date", array[] of {"value"}, 1); bidateproto := array[] of { Builtin("toString", "Date.prototype.toString", nil, 0), Builtin("toDateString", "Date.prototype.toDateString", nil, 0), Builtin("toTimeString", "Date.prototype.toTimeString", nil, 0), Builtin("toLocaleString", "Date.prototype.toLocalString", nil, 0), Builtin("toLocaleDateString", "Date.prototype.toLocaleDateString", nil, 0), Builtin("toLocaleTimeString", "Date.prototype.toLocaleTimeString", nil, 0), Builtin("valueOf", "Date.prototype.valueOf", nil, 0), Builtin("getTime", "Date.prototype.getTime", nil, 0), Builtin("getYear", "Date.prototype.getYear", nil, 0), Builtin("getFullYear", "Date.prototype.getFullYear", nil, 0), Builtin("getUTCFullYear", "Date.prototype.getUTCFullYear", nil, 0), Builtin("getMonth", "Date.prototype.getMonth", nil, 0), Builtin("getUTCMonth", "Date.prototype.getUTCMonth", nil, 0), Builtin("getDate", "Date.prototype.getDate", nil, 0), Builtin("getUTCDate", "Date.prototype.getUTCDate", nil, 0), Builtin("getDay", "Date.prototype.getDay", nil, 0), Builtin("getUTCDay", "Date.prototype.getUTCDay", nil, 0), Builtin("getHours", "Date.prototype.getHours", nil, 0), Builtin("getUTCHours", "Date.prototype.getUTCHours", nil, 0), Builtin("getMinutes", "Date.prototype.getMinutes", nil, 0), Builtin("getUTCMinutes", "Date.prototype.getUTCMinutes", nil, 0), Builtin("getSeconds", "Date.prototype.getSeconds", nil, 0), Builtin("getUTCSeconds", "Date.prototype.getUTCSeconds", nil, 0), Builtin("getMilliseconds", "Date.prototype.getMilliseconds", nil, 0), Builtin("getUTCMilliseconds", "Date.prototype.getUTCMilliseconds", nil, 0), Builtin("getTimezoneOffset", "Date.prototype.getTimezoneOffset", nil, 0), Builtin("setTime", "Date.prototype.setTime", array[] of {"time"}, 1), Builtin("setMilliseconds", "Date.prototype.setMilliseconds", array[] of {"ms"}, 1), Builtin("setUTCMilliseconds", "Date.prototype.setUTCMilliseconds", array[] of {"ms"}, 1), Builtin("setSeconds", "Date.prototype.setSeconds", array[] of {"sec", "ms"}, 2), Builtin("setUTCSeconds", "Date.prototype.setUTCSeconds", array[] of {"sec", "ms"}, 2), Builtin("setMinutes", "Date.prototype.setMinutes", array[] of {"min", "sec", "ms"}, 3), Builtin("setUTCMinutes", "Date.prototype.setUTCMinutes", array[] of {"min", "sec", "ms"}, 3), Builtin("setHours", "Date.prototype.setHours", array[] of {"hour", "min", "sec", "ms"}, 4), Builtin("setUTCHours", "Date.prototype.setUTCHours", array[] of {"hour", "min", "sec", "ms"}, 4), Builtin("setDate", "Date.prototype.setDate", array[] of {"date"}, 1), Builtin("setUTCDate", "Date.prototype.setUTCDate", array[] of {"date"}, 1), Builtin("setMonth", "Date.prototype.setMonth", array[] of {"mon", "date"}, 2), Builtin("setUTCMonth", "Date.prototype.setUTCMonth", array[] of {"mon", "date"}, 2), Builtin("setFullYear", "Date.prototype.setFullYear", array[] of {"year", "mon", "date"}, 3), Builtin("setUTCFullYear", "Date.prototype.setUTCFullYear", array[] of {"year", "mon", "date"}, 3), Builtin("setYear", "Date.prototype.setYear", array[] of {"year"}, 1), Builtin("toLocaleString", "Date.prototype.toLocaleString", nil, 0), Builtin("toUTCString", "Date.prototype.toUTCString", nil, 0), Builtin("toGMTString", "Date.prototype.toGMTString", nil, 0), }; bidatector := array[] of { Builtin("parse", "Date.parse", array[] of {"string"}, 1), Builtin("UTC", "Date.UTC", array[] of {"year", "month", "date", "hours", "minutes", "seconds", "ms"}, 7), }; bimath := array[] of { Builtin("abs", "Math.abs", array[] of {"x"}, 1), Builtin("acos", "Math.acos", array[] of {"x"}, 1), Builtin("asin", "Math.asin", array[] of {"x"}, 1), Builtin("atan", "Math.atan", array[] of {"x"}, 1), Builtin("atan2", "Math.atan2", array[] of {"y", "x"}, 2), Builtin("ceil", "Math.ceil", array[] of {"x"}, 1), Builtin("cos", "Math.cos", array[] of {"x"}, 1), Builtin("exp", "Math.exp", array[] of {"x"}, 1), Builtin("floor", "Math.floor", array[] of {"x"}, 1), Builtin("log", "Math.log", array[] of {"x"}, 1), Builtin("max", "Math.max", array[] of {"x", "y"}, 2), Builtin("min", "Math.min", array[] of {"x", "y"}, 2), Builtin("pow", "Math.pow", array[] of {"x", "y"}, 2), Builtin("random", "Math.random", nil, 0), Builtin("round", "Math.round", array[] of {"x"}, 1), Builtin("sin", "Math.sin", array[] of {"x"}, 1), Builtin("sqrt", "Math.sqrt", array[] of {"x"}, 1), Builtin("tan", "Math.tan", array[] of {"x"}, 1), }; init(): string