Refactored Narcissus to use the module pattern (bug 583913, r=pwalton)

This commit is contained in:
Tom Austin 2010-08-03 17:15:02 -07:00
parent 82f628bc0b
commit 718da39323
9 changed files with 3750 additions and 3813 deletions

View File

@ -1,66 +0,0 @@
/* -*- Mode: JS; tab-width: 4; indent-tabs-mode: nil; -*-
* vim: set sw=4 ts=8 et tw=78:
/* ***** BEGIN LICENSE BLOCK *****
*
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Narcissus JavaScript engine.
*
* The Initial Developer of the Original Code is
* Brendan Eich <brendan@mozilla.org>.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* Narcissus - JS implemented in JS.
*
* Native objects and classes implemented metacircularly:
* the global object (singleton)
* eval
* function objects, Function
*
* SpiderMonkey extensions used:
* catch guards
* const declarations
* get and set functions in object initialisers
* Object.prototype.__proto__
* filename and line number arguments to *Error constructors
* callable regular expression objects
*
* SpiderMonkey extensions supported metacircularly:
* catch guards
* const declarations
* get and set functions in object initialisers
*/
load('jsdefs.js');
load('jslex.js');
load('jsparse.js');
load('jsexec.js');

View File

@ -1,3 +1,4 @@
/* vim: set sw=4 ts=4 et tw=78: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -42,139 +43,157 @@
* separately to take advantage of the simple switch-case constant propagation
* done by SpiderMonkey.
*/
var tokens = [
// End of source.
"END",
Narcissus = {};
Narcissus.jsdefs = (function() {
// Operators and punctuators. Some pair-wise order matters, e.g. (+, -)
// and (UNARY_PLUS, UNARY_MINUS).
"\n", ";",
",",
"=",
"?", ":", "CONDITIONAL",
"||",
"&&",
"|",
"^",
"&",
"==", "!=", "===", "!==",
"<", "<=", ">=", ">",
"<<", ">>", ">>>",
"+", "-",
"*", "/", "%",
"!", "~", "UNARY_PLUS", "UNARY_MINUS",
"++", "--",
".",
"[", "]",
"{", "}",
"(", ")",
// Nonterminal tree node type codes.
"SCRIPT", "BLOCK", "LABEL", "FOR_IN", "CALL", "NEW_WITH_ARGS", "INDEX",
"ARRAY_INIT", "OBJECT_INIT", "PROPERTY_INIT", "GETTER", "SETTER",
"GROUP", "LIST", "LET_BLOCK", "ARRAY_COMP", "GENERATOR", "COMP_TAIL",
// Terminals.
"IDENTIFIER", "NUMBER", "STRING", "REGEXP",
// Keywords.
"break",
"case", "catch", "const", "continue",
"debugger", "default", "delete", "do",
"else",
"false", "finally", "for", "function",
"if", "in", "instanceof",
"let",
"new", "null",
"return",
"switch",
"this", "throw", "true", "try", "typeof",
"var", "void",
"yield",
"while", "with",
];
// Operator and punctuator mapping from token to tree node type name.
// NB: because the lexer doesn't backtrack, all token prefixes must themselves
// be valid tokens (e.g. !== is acceptable because its prefixes are the valid
// tokens != and !).
var opTypeNames = {
'\n': "NEWLINE",
';': "SEMICOLON",
',': "COMMA",
'?': "HOOK",
':': "COLON",
'||': "OR",
'&&': "AND",
'|': "BITWISE_OR",
'^': "BITWISE_XOR",
'&': "BITWISE_AND",
'===': "STRICT_EQ",
'==': "EQ",
'=': "ASSIGN",
'!==': "STRICT_NE",
'!=': "NE",
'<<': "LSH",
'<=': "LE",
'<': "LT",
'>>>': "URSH",
'>>': "RSH",
'>=': "GE",
'>': "GT",
'++': "INCREMENT",
'--': "DECREMENT",
'+': "PLUS",
'-': "MINUS",
'*': "MUL",
'/': "DIV",
'%': "MOD",
'!': "NOT",
'~': "BITWISE_NOT",
'.': "DOT",
'[': "LEFT_BRACKET",
']': "RIGHT_BRACKET",
'{': "LEFT_CURLY",
'}': "RIGHT_CURLY",
'(': "LEFT_PAREN",
')': "RIGHT_PAREN"
};
// Hash of keyword identifier to tokens index. NB: we must null __proto__ to
// avoid toString, etc. namespace pollution.
var keywords = {__proto__: null};
// Define const END, etc., based on the token names. Also map name to index.
var tokenIds = {};
var consts = "const ";
for (var i = 0, j = tokens.length; i < j; i++) {
if (i > 0)
consts += ", ";
var t = tokens[i];
var name;
if (/^[a-z]/.test(t)) {
name = t.toUpperCase();
keywords[t] = i;
} else {
name = (/^\W/.test(t) ? opTypeNames[t] : t);
var tokens = [
// End of source.
"END",
// Operators and punctuators. Some pair-wise order matters, e.g. (+, -)
// and (UNARY_PLUS, UNARY_MINUS).
"\n", ";",
",",
"=",
"?", ":", "CONDITIONAL",
"||",
"&&",
"|",
"^",
"&",
"==", "!=", "===", "!==",
"<", "<=", ">=", ">",
"<<", ">>", ">>>",
"+", "-",
"*", "/", "%",
"!", "~", "UNARY_PLUS", "UNARY_MINUS",
"++", "--",
".",
"[", "]",
"{", "}",
"(", ")",
// Nonterminal tree node type codes.
"SCRIPT", "BLOCK", "LABEL", "FOR_IN", "CALL", "NEW_WITH_ARGS", "INDEX",
"ARRAY_INIT", "OBJECT_INIT", "PROPERTY_INIT", "GETTER", "SETTER",
"GROUP", "LIST", "LET_BLOCK", "ARRAY_COMP", "GENERATOR", "COMP_TAIL",
// Terminals.
"IDENTIFIER", "NUMBER", "STRING", "REGEXP",
// Keywords.
"break",
"case", "catch", "const", "continue",
"debugger", "default", "delete", "do",
"else",
"false", "finally", "for", "function",
"if", "in", "instanceof",
"let",
"new", "null",
"return",
"switch",
"this", "throw", "true", "try", "typeof",
"var", "void",
"yield",
"while", "with",
];
// Operator and punctuator mapping from token to tree node type name.
// NB: because the lexer doesn't backtrack, all token prefixes must themselves
// be valid tokens (e.g. !== is acceptable because its prefixes are the valid
// tokens != and !).
var opTypeNames = {
'\n': "NEWLINE",
';': "SEMICOLON",
',': "COMMA",
'?': "HOOK",
':': "COLON",
'||': "OR",
'&&': "AND",
'|': "BITWISE_OR",
'^': "BITWISE_XOR",
'&': "BITWISE_AND",
'===': "STRICT_EQ",
'==': "EQ",
'=': "ASSIGN",
'!==': "STRICT_NE",
'!=': "NE",
'<<': "LSH",
'<=': "LE",
'<': "LT",
'>>>': "URSH",
'>>': "RSH",
'>=': "GE",
'>': "GT",
'++': "INCREMENT",
'--': "DECREMENT",
'+': "PLUS",
'-': "MINUS",
'*': "MUL",
'/': "DIV",
'%': "MOD",
'!': "NOT",
'~': "BITWISE_NOT",
'.': "DOT",
'[': "LEFT_BRACKET",
']': "RIGHT_BRACKET",
'{': "LEFT_CURLY",
'}': "RIGHT_CURLY",
'(': "LEFT_PAREN",
')': "RIGHT_PAREN"
};
// Hash of keyword identifier to tokens index. NB: we must null __proto__ to
// avoid toString, etc. namespace pollution.
var keywords = {__proto__: null};
// Define const END, etc., based on the token names. Also map name to index.
var tokenIds = {};
// Building up a string to be eval'd in different contexts.
var consts = "const ";
for (var i = 0, j = tokens.length; i < j; i++) {
if (i > 0)
consts += ", ";
var t = tokens[i];
var name;
if (/^[a-z]/.test(t)) {
name = t.toUpperCase();
keywords[t] = i;
} else {
name = (/^\W/.test(t) ? opTypeNames[t] : t);
}
consts += name + " = " + i;
tokenIds[name] = i;
tokens[t] = i;
}
consts += name + " = " + i;
tokenIds[name] = i;
tokens[t] = i;
}
eval(consts + ";");
consts += ";";
// Map assignment operators to their indexes in the tokens array.
var assignOps = ['|', '^', '&', '<<', '>>', '>>>', '+', '-', '*', '/', '%'];
for (i = 0, j = assignOps.length; i < j; i++) {
t = assignOps[i];
assignOps[t] = tokens[t];
}
function defineGetter(obj, prop, fn, dontDelete, dontEnum) {
Object.defineProperty(obj, prop, { get: fn, configurable: !dontDelete, enumerable: !dontEnum });
}
function defineProperty(obj, prop, val, dontDelete, readOnly, dontEnum) {
Object.defineProperty(obj, prop, { value: val, writable: !readOnly, configurable: !dontDelete, enumerable: !dontEnum });
}
return {
"tokens": tokens,
"opTypeNames": opTypeNames,
"keywords": keywords,
"tokenIds": tokenIds,
"consts": consts,
"assignOps": assignOps,
"defineGetter": defineGetter,
"defineProperty": defineProperty
};
}());
// Map assignment operators to their indexes in the tokens array.
var assignOps = ['|', '^', '&', '<<', '>>', '>>>', '+', '-', '*', '/', '%'];
for (i = 0, j = assignOps.length; i < j; i++) {
t = assignOps[i];
assignOps[t] = tokens[t];
}
function defineGetter(obj, prop, fn, dontDelete, dontEnum) {
Object.defineProperty(obj, prop, { get: fn, configurable: !dontDelete, enumerable: !dontEnum });
}
function defineProperty(obj, prop, val, dontDelete, readOnly, dontEnum) {
Object.defineProperty(obj, prop, { value: val, writable: !readOnly, configurable: !dontDelete, enumerable: !dontEnum });
}

File diff suppressed because it is too large Load Diff

View File

@ -41,417 +41,429 @@
* Lexical scanner.
*/
// Build up a trie of operator tokens.
var opTokens = {};
for (var op in opTypeNames) {
if (op === '\n' || op === '.')
continue;
Narcissus.jslex = (function() {
var node = opTokens;
for (var i = 0; i < op.length; i++) {
var ch = op[i];
if (!(ch in node))
node[ch] = {};
node = node[ch];
node.op = op;
}
}
/*
* Tokenizer :: (file ptr, path, line number) -> Tokenizer
*/
function Tokenizer(s, f, l) {
this.cursor = 0;
this.source = String(s);
this.tokens = [];
this.tokenIndex = 0;
this.lookahead = 0;
this.scanNewlines = false;
this.filename = f || "";
this.lineno = l || 1;
}
Tokenizer.prototype = {
get done() {
// We need to set scanOperand to true here because the first thing
// might be a regexp.
return this.peek(true) == END;
},
get token() {
return this.tokens[this.tokenIndex];
},
match: function (tt, scanOperand) {
return this.get(scanOperand) == tt || this.unget();
},
mustMatch: function (tt) {
if (!this.match(tt))
throw this.newSyntaxError("Missing " + tokens[tt].toLowerCase());
return this.token;
},
peek: function (scanOperand) {
var tt, next;
if (this.lookahead) {
next = this.tokens[(this.tokenIndex + this.lookahead) & 3];
tt = (this.scanNewlines && next.lineno != this.lineno)
? NEWLINE
: next.type;
} else {
tt = this.get(scanOperand);
this.unget();
var jsdefs = Narcissus.jsdefs;
// Set constants in the local scope.
eval(jsdefs.consts);
// Build up a trie of operator tokens.
var opTokens = {};
for (var op in jsdefs.opTypeNames) {
if (op === '\n' || op === '.')
continue;
var node = opTokens;
for (var i = 0; i < op.length; i++) {
var ch = op[i];
if (!(ch in node))
node[ch] = {};
node = node[ch];
node.op = op;
}
return tt;
},
peekOnSameLine: function (scanOperand) {
this.scanNewlines = true;
var tt = this.peek(scanOperand);
}
/*
* Tokenizer :: (file ptr, path, line number) -> Tokenizer
*/
function Tokenizer(s, f, l) {
this.cursor = 0;
this.source = String(s);
this.tokens = [];
this.tokenIndex = 0;
this.lookahead = 0;
this.scanNewlines = false;
return tt;
},
// Eats comments and whitespace.
skip: function () {
var input = this.source;
for (;;) {
var ch = input[this.cursor++];
var next = input[this.cursor];
if (ch === '\n' && !this.scanNewlines) {
this.lineno++;
} else if (ch === '/' && next === '*') {
this.cursor++;
for (;;) {
ch = input[this.cursor++];
if (ch === undefined)
throw this.newSyntaxError("Unterminated comment");
if (ch === '*') {
next = input[this.cursor];
if (next === '/') {
this.cursor++;
this.filename = f || "";
this.lineno = l || 1;
}
Tokenizer.prototype = {
get done() {
// We need to set scanOperand to true here because the first thing
// might be a regexp.
return this.peek(true) == END;
},
get token() {
return this.tokens[this.tokenIndex];
},
match: function (tt, scanOperand) {
return this.get(scanOperand) == tt || this.unget();
},
mustMatch: function (tt) {
if (!this.match(tt))
throw this.newSyntaxError("Missing " + tokens[tt].toLowerCase());
return this.token;
},
peek: function (scanOperand) {
var tt, next;
if (this.lookahead) {
next = this.tokens[(this.tokenIndex + this.lookahead) & 3];
tt = (this.scanNewlines && next.lineno != this.lineno)
? NEWLINE
: next.type;
} else {
tt = this.get(scanOperand);
this.unget();
}
return tt;
},
peekOnSameLine: function (scanOperand) {
this.scanNewlines = true;
var tt = this.peek(scanOperand);
this.scanNewlines = false;
return tt;
},
// Eats comments and whitespace.
skip: function () {
var input = this.source;
for (;;) {
var ch = input[this.cursor++];
var next = input[this.cursor];
if (ch === '\n' && !this.scanNewlines) {
this.lineno++;
} else if (ch === '/' && next === '*') {
this.cursor++;
for (;;) {
ch = input[this.cursor++];
if (ch === undefined)
throw this.newSyntaxError("Unterminated comment");
if (ch === '*') {
next = input[this.cursor];
if (next === '/') {
this.cursor++;
break;
}
} else if (ch === '\n') {
this.lineno++;
}
}
} else if (ch === '/' && next === '/') {
this.cursor++;
for (;;) {
ch = input[this.cursor++];
if (ch === undefined)
return;
if (ch === '\n') {
this.lineno++;
break;
}
} else if (ch === '\n') {
this.lineno++;
}
} else if (ch !== ' ' && ch !== '\t') {
this.cursor--;
return;
}
} else if (ch === '/' && next === '/') {
}
},
// Lexes the exponential part of a number, if present. Returns true iff an
// exponential part was found.
lexExponent: function() {
var input = this.source;
var next = input[this.cursor];
if (next === 'e' || next === 'E') {
this.cursor++;
for (;;) {
ch = input[this.cursor++];
if (ch === '+' || ch === '-')
ch = input[this.cursor++];
if (ch === undefined)
return;
if (ch === '\n') {
this.lineno++;
break;
}
}
} else if (ch !== ' ' && ch !== '\t') {
this.cursor--;
return;
}
}
},
// Lexes the exponential part of a number, if present. Returns true iff an
// exponential part was found.
lexExponent: function() {
var input = this.source;
var next = input[this.cursor];
if (next === 'e' || next === 'E') {
this.cursor++;
ch = input[this.cursor++];
if (ch === '+' || ch === '-')
ch = input[this.cursor++];
if (ch < '0' || ch > '9')
throw this.newSyntaxError("Missing exponent");
do {
ch = input[this.cursor++];
} while (ch >= '0' && ch <= '9');
this.cursor--;
return true;
}
return false;
},
lexZeroNumber: function (ch) {
var token = this.token, input = this.source;
token.type = NUMBER;
ch = input[this.cursor++];
if (ch === '.') {
do {
ch = input[this.cursor++];
} while (ch >= '0' && ch <= '9');
this.cursor--;
this.lexExponent();
token.value = parseFloat(token.start, this.cursor);
} else if (ch === 'x' || ch === 'X') {
do {
ch = input[this.cursor++];
} while ((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f') ||
(ch >= 'A' && ch <= 'F'));
this.cursor--;
token.value = parseInt(input.substring(token.start, this.cursor));
} else if (ch >= '0' && ch <= '7') {
do {
ch = input[this.cursor++];
} while (ch >= '0' && ch <= '7');
this.cursor--;
token.value = parseInt(input.substring(token.start, this.cursor));
} else {
this.cursor--;
this.lexExponent(); // 0E1, &c.
token.value = 0;
}
},
lexNumber: function (ch) {
var token = this.token, input = this.source;
token.type = NUMBER;
var floating = false;
do {
ch = input[this.cursor++];
if (ch === '.' && !floating) {
floating = true;
ch = input[this.cursor++];
}
} while (ch >= '0' && ch <= '9');
this.cursor--;
var exponent = this.lexExponent();
floating = floating || exponent;
var str = input.substring(token.start, this.cursor);
token.value = floating ? parseFloat(str) : parseInt(str);
},
lexDot: function (ch) {
var token = this.token, input = this.source;
var next = input[this.cursor];
if (next >= '0' && next <= '9') {
do {
ch = input[this.cursor++];
} while (ch >= '0' && ch <= '9');
this.cursor--;
this.lexExponent();
token.type = NUMBER;
token.value = parseFloat(token.start, this.cursor);
} else {
token.type = DOT;
token.assignOp = null;
token.value = '.';
}
},
lexString: function (ch) {
var token = this.token, input = this.source;
token.type = STRING;
var hasEscapes = false;
var delim = ch;
ch = input[this.cursor++];
while (ch !== delim) {
if (ch === '\\') {
hasEscapes = true;
this.cursor++;
}
ch = input[this.cursor++];
}
token.value = (hasEscapes)
? eval(input.substring(token.start, this.cursor))
: input.substring(token.start + 1, this.cursor - 1);
},
lexRegExp: function (ch) {
var token = this.token, input = this.source;
token.type = REGEXP;
do {
ch = input[this.cursor++];
if (ch === '\\') {
this.cursor++;
} else if (ch === '[') {
if (ch < '0' || ch > '9')
throw this.newSyntaxError("Missing exponent");
do {
if (ch === undefined)
throw this.newSyntaxError("Unterminated character class");
if (ch === '\\')
this.cursor++;
ch = input[this.cursor++];
} while (ch !== ']');
} else if (ch === undefined) {
throw this.newSyntaxError("Unterminated regex");
} while (ch >= '0' && ch <= '9');
this.cursor--;
return true;
}
} while (ch !== '/');
do {
return false;
},
lexZeroNumber: function (ch) {
var token = this.token, input = this.source;
token.type = NUMBER;
ch = input[this.cursor++];
} while (ch >= 'a' && ch <= 'z');
this.cursor--;
token.value = eval(input.substring(token.start, this.cursor));
},
lexOp: function (ch) {
var token = this.token, input = this.source;
// A bit ugly, but it seems wasteful to write a trie lookup routine for
// only 3 characters...
var node = opTokens[ch];
var next = input[this.cursor];
if (next in node) {
node = node[next];
this.cursor++;
next = input[this.cursor];
if (ch === '.') {
do {
ch = input[this.cursor++];
} while (ch >= '0' && ch <= '9');
this.cursor--;
this.lexExponent();
token.value = parseFloat(token.start, this.cursor);
} else if (ch === 'x' || ch === 'X') {
do {
ch = input[this.cursor++];
} while ((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f') ||
(ch >= 'A' && ch <= 'F'));
this.cursor--;
token.value = parseInt(input.substring(token.start, this.cursor));
} else if (ch >= '0' && ch <= '7') {
do {
ch = input[this.cursor++];
} while (ch >= '0' && ch <= '7');
this.cursor--;
token.value = parseInt(input.substring(token.start, this.cursor));
} else {
this.cursor--;
this.lexExponent(); // 0E1, &c.
token.value = 0;
}
},
lexNumber: function (ch) {
var token = this.token, input = this.source;
token.type = NUMBER;
var floating = false;
do {
ch = input[this.cursor++];
if (ch === '.' && !floating) {
floating = true;
ch = input[this.cursor++];
}
} while (ch >= '0' && ch <= '9');
this.cursor--;
var exponent = this.lexExponent();
floating = floating || exponent;
var str = input.substring(token.start, this.cursor);
token.value = floating ? parseFloat(str) : parseInt(str);
},
lexDot: function (ch) {
var token = this.token, input = this.source;
var next = input[this.cursor];
if (next >= '0' && next <= '9') {
do {
ch = input[this.cursor++];
} while (ch >= '0' && ch <= '9');
this.cursor--;
this.lexExponent();
token.type = NUMBER;
token.value = parseFloat(token.start, this.cursor);
} else {
token.type = DOT;
token.assignOp = null;
token.value = '.';
}
},
lexString: function (ch) {
var token = this.token, input = this.source;
token.type = STRING;
var hasEscapes = false;
var delim = ch;
ch = input[this.cursor++];
while (ch !== delim) {
if (ch === '\\') {
hasEscapes = true;
this.cursor++;
}
ch = input[this.cursor++];
}
token.value = (hasEscapes)
? eval(input.substring(token.start, this.cursor))
: input.substring(token.start + 1, this.cursor - 1);
},
lexRegExp: function (ch) {
var token = this.token, input = this.source;
token.type = REGEXP;
do {
ch = input[this.cursor++];
if (ch === '\\') {
this.cursor++;
} else if (ch === '[') {
do {
if (ch === undefined)
throw this.newSyntaxError("Unterminated character class");
if (ch === '\\')
this.cursor++;
ch = input[this.cursor++];
} while (ch !== ']');
} else if (ch === undefined) {
throw this.newSyntaxError("Unterminated regex");
}
} while (ch !== '/');
do {
ch = input[this.cursor++];
} while (ch >= 'a' && ch <= 'z');
this.cursor--;
token.value = eval(input.substring(token.start, this.cursor));
},
lexOp: function (ch) {
var token = this.token, input = this.source;
// A bit ugly, but it seems wasteful to write a trie lookup routine for
// only 3 characters...
var node = opTokens[ch];
var next = input[this.cursor];
if (next in node) {
node = node[next];
this.cursor++;
next = input[this.cursor];
if (next in node) {
node = node[next];
this.cursor++;
next = input[this.cursor];
}
}
}
var op = node.op;
if (assignOps[op] && input[this.cursor] === '=') {
this.cursor++;
token.type = ASSIGN;
token.assignOp = tokenIds[opTypeNames[op]];
op += '=';
} else {
token.type = tokenIds[opTypeNames[op]];
token.assignOp = null;
}
token.value = op;
},
// FIXME: Unicode escape sequences
// FIXME: Unicode identifiers
lexIdent: function (ch) {
var token = this.token, input = this.source;
do {
ch = input[this.cursor++];
} while ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ||
(ch >= '0' && ch <= '9') || ch === '$' || ch === '_');
this.cursor--; // Put the non-word character back.
var id = input.substring(token.start, this.cursor);
token.type = keywords[id] || IDENTIFIER;
token.value = id;
},
/*
* Tokenizer.get :: void -> token type
*
* Consumes input *only* if there is no lookahead.
* Dispatch to the appropriate lexing function depending on the input.
*/
get: function (scanOperand) {
var token;
while (this.lookahead) {
--this.lookahead;
var op = node.op;
if (jsdefs.assignOps[op] && input[this.cursor] === '=') {
this.cursor++;
token.type = ASSIGN;
token.assignOp = jsdefs.tokenIds[jsdefs.opTypeNames[op]];
op += '=';
} else {
token.type = jsdefs.tokenIds[jsdefs.opTypeNames[op]];
token.assignOp = null;
}
token.value = op;
},
// FIXME: Unicode escape sequences
// FIXME: Unicode identifiers
lexIdent: function (ch) {
var token = this.token, input = this.source;
do {
ch = input[this.cursor++];
} while ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ||
(ch >= '0' && ch <= '9') || ch === '$' || ch === '_');
this.cursor--; // Put the non-word character back.
var id = input.substring(token.start, this.cursor);
token.type = jsdefs.keywords[id] || IDENTIFIER;
token.value = id;
},
/*
* Tokenizer.get :: void -> token type
*
* Consumes input *only* if there is no lookahead.
* Dispatch to the appropriate lexing function depending on the input.
*/
get: function (scanOperand) {
var token;
while (this.lookahead) {
--this.lookahead;
this.tokenIndex = (this.tokenIndex + 1) & 3;
token = this.tokens[this.tokenIndex];
if (token.type != NEWLINE || this.scanNewlines)
return token.type;
}
this.skip();
this.tokenIndex = (this.tokenIndex + 1) & 3;
token = this.tokens[this.tokenIndex];
if (token.type != NEWLINE || this.scanNewlines)
return token.type;
if (!token)
this.tokens[this.tokenIndex] = token = {};
var input = this.source;
if (this.cursor === input.length)
return token.type = END;
token.start = this.cursor;
token.lineno = this.lineno;
var ch = input[this.cursor++];
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ||
ch === '$' || ch === '_') {
this.lexIdent(ch);
} else if (scanOperand && ch === '/') {
this.lexRegExp(ch);
} else if (ch in opTokens) {
this.lexOp(ch);
} else if (ch === '.') {
this.lexDot(ch);
} else if (ch >= '1' && ch <= '9') {
this.lexNumber(ch);
} else if (ch === '0') {
this.lexZeroNumber(ch);
} else if (ch === '"' || ch === "'") {
this.lexString(ch);
} else if (this.scanNewlines && ch === '\n') {
token.type = NEWLINE;
token.value = '\n';
this.lineno++;
} else {
throw this.newSyntaxError("Illegal token");
}
token.end = this.cursor;
return token.type;
},
/*
* Tokenizer.unget :: void -> undefined
*
* Match depends on unget returning undefined.
*/
unget: function () {
if (++this.lookahead == 4) throw "PANIC: too much lookahead!";
this.tokenIndex = (this.tokenIndex - 1) & 3;
},
newSyntaxError: function (m) {
var e = new SyntaxError(m, this.filename, this.lineno);
e.source = this.source;
e.cursor = this.cursor;
return e;
},
save: function () {
return {
cursor: this.cursor,
tokenIndex: this.tokenIndex,
tokens: this.tokens.slice(),
lookahead: this.lookahead,
scanNewlines: this.scanNewlines,
lineno: this.lineno
};
},
rewind: function(point) {
this.cursor = point.cursor;
this.tokenIndex = point.tokenIndex;
this.tokens = point.tokens.slice();
this.lookahead = point.lookahead;
this.scanNewline = point.scanNewline;
this.lineno = point.lineno;
}
};
return { "Tokenizer": Tokenizer };
this.skip();
}());
this.tokenIndex = (this.tokenIndex + 1) & 3;
token = this.tokens[this.tokenIndex];
if (!token)
this.tokens[this.tokenIndex] = token = {};
var input = this.source;
if (this.cursor === input.length)
return token.type = END;
token.start = this.cursor;
token.lineno = this.lineno;
var ch = input[this.cursor++];
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ||
ch === '$' || ch === '_') {
this.lexIdent(ch);
} else if (scanOperand && ch === '/') {
this.lexRegExp(ch);
} else if (ch in opTokens) {
this.lexOp(ch);
} else if (ch === '.') {
this.lexDot(ch);
} else if (ch >= '1' && ch <= '9') {
this.lexNumber(ch);
} else if (ch === '0') {
this.lexZeroNumber(ch);
} else if (ch === '"' || ch === "'") {
this.lexString(ch);
} else if (this.scanNewlines && ch === '\n') {
token.type = NEWLINE;
token.value = '\n';
this.lineno++;
} else {
throw this.newSyntaxError("Illegal token");
}
token.end = this.cursor;
return token.type;
},
/*
* Tokenizer.unget :: void -> undefined
*
* Match depends on unget returning undefined.
*/
unget: function () {
if (++this.lookahead == 4) throw "PANIC: too much lookahead!";
this.tokenIndex = (this.tokenIndex - 1) & 3;
},
newSyntaxError: function (m) {
var e = new SyntaxError(m, this.filename, this.lineno);
e.source = this.source;
e.cursor = this.cursor;
return e;
},
save: function () {
return {
cursor: this.cursor,
tokenIndex: this.tokenIndex,
tokens: this.tokens.slice(),
lookahead: this.lookahead,
scanNewlines: this.scanNewlines,
lineno: this.lineno
};
},
rewind: function(point) {
this.cursor = point.cursor;
this.tokenIndex = point.tokenIndex;
this.tokens = point.tokens.slice();
this.lookahead = point.lookahead;
this.scanNewline = point.scanNewline;
this.lineno = point.lineno;
}
};

File diff suppressed because it is too large Load Diff

View File

@ -28,14 +28,14 @@ if __name__ == '__main__':
(options, args) = op.parse_args()
cmd = 'evaluate("__NARCISSUS__=true;"); '
cmd = ""
if options.js_exps:
for exp in options.js_exps:
cmd += 'evaluate("%s"); ' % exp.replace('"', '\\"')
cmd += 'Narcissus.jsexec.evaluate("%s"); ' % exp.replace('"', '\\"')
if options.js_files:
for file in options.js_files:
cmd += 'evaluate(snarf("%(file)s"), "%(file)s", 1); ' % {'file':file }
cmd += 'Narcissus.jsexec.evaluate(snarf("%(file)s"), "%(file)s", 1); ' % { 'file':file }
Popen([js_cmd, '-f', narc_jsdefs, '-f', narc_jslex, '-f', narc_jsparse, '-f', narc_jsexec, '-e', cmd]).wait()

View File

@ -86,7 +86,6 @@ narcissus/../e4x/Regress/regress-329257.js
narcissus/../e4x/Regress/regress-331558.js
narcissus/../e4x/Regress/regress-331664.js
narcissus/../e4x/Regress/regress-344455.js
narcissus/../e4x/Regress/regress-347155.js
narcissus/../e4x/Regress/regress-350206-1.js
narcissus/../e4x/Regress/regress-350206.js
narcissus/../e4x/Regress/regress-350238.js
@ -124,7 +123,6 @@ narcissus/../e4x/Regress/regress-374112.js
narcissus/../e4x/Regress/regress-374116.js
narcissus/../e4x/Regress/regress-374160.js
narcissus/../e4x/Regress/regress-375406.js
narcissus/../e4x/Regress/regress-378492.js
narcissus/../e4x/Regress/regress-380833.js
narcissus/../e4x/Regress/regress-383255.js
narcissus/../e4x/Regress/regress-394941.js
@ -136,9 +134,7 @@ narcissus/../e4x/Regress/regress-458679-02.js
narcissus/../e4x/Regress/regress-460180.js
narcissus/../e4x/Regress/regress-465063.js
narcissus/../e4x/Regress/regress-470619.js
narcissus/../e4x/Regress/regress-473709.js
narcissus/../e4x/Regress/regress-474319.js
narcissus/../e4x/Regress/regress-477053.js
narcissus/../e4x/Regress/regress-561031.js
narcissus/../e4x/Statements/12.1.js
narcissus/../e4x/Statements/12.2.js
@ -408,6 +404,7 @@ narcissus/../ecma/Math/15.8.2.2.js
narcissus/../ecma/Math/15.8.2.6.js
narcissus/../ecma/Math/15.8.2.7.js
narcissus/../ecma/Math/15.8.2.9.js
narcissus/../ecma/Number/0x-without-following-hexdigits.js
narcissus/../ecma/Number/15.7.4.2-2-n.js
narcissus/../ecma/Number/15.7.4.2-3-n.js
narcissus/../ecma/Number/15.7.4.3-3-n.js
@ -465,10 +462,8 @@ narcissus/../ecma_2/Exceptions/exception-004.js
narcissus/../ecma_2/Exceptions/exception-005.js
narcissus/../ecma_2/Exceptions/exception-006.js
narcissus/../ecma_2/Exceptions/exception-007.js
narcissus/../ecma_2/Exceptions/exception-008.js
narcissus/../ecma_2/Exceptions/exception-010-n.js
narcissus/../ecma_2/Exceptions/exception-011-n.js
narcissus/../ecma_2/Exceptions/expression-001.js
narcissus/../ecma_2/Exceptions/expression-002.js
narcissus/../ecma_2/Exceptions/expression-003.js
narcissus/../ecma_2/Exceptions/expression-004.js
@ -482,7 +477,6 @@ narcissus/../ecma_2/Exceptions/expression-011.js
narcissus/../ecma_2/Exceptions/expression-012.js
narcissus/../ecma_2/Exceptions/expression-013.js
narcissus/../ecma_2/Exceptions/expression-014.js
narcissus/../ecma_2/Exceptions/expression-015.js
narcissus/../ecma_2/Exceptions/expression-016.js
narcissus/../ecma_2/Exceptions/expression-017.js
narcissus/../ecma_2/Exceptions/expression-019.js
@ -490,64 +484,25 @@ narcissus/../ecma_2/Exceptions/global-001.js
narcissus/../ecma_2/Exceptions/global-002.js
narcissus/../ecma_2/Exceptions/lexical-001.js
narcissus/../ecma_2/Exceptions/lexical-002.js
narcissus/../ecma_2/Exceptions/lexical-003.js
narcissus/../ecma_2/Exceptions/lexical-004.js
narcissus/../ecma_2/Exceptions/lexical-005.js
narcissus/../ecma_2/Exceptions/lexical-006.js
narcissus/../ecma_2/Exceptions/lexical-007.js
narcissus/../ecma_2/Exceptions/lexical-008.js
narcissus/../ecma_2/Exceptions/lexical-009.js
narcissus/../ecma_2/Exceptions/lexical-011.js
narcissus/../ecma_2/Exceptions/lexical-012.js
narcissus/../ecma_2/Exceptions/lexical-013.js
narcissus/../ecma_2/Exceptions/lexical-014.js
narcissus/../ecma_2/Exceptions/lexical-015.js
narcissus/../ecma_2/Exceptions/lexical-016.js
narcissus/../ecma_2/Exceptions/lexical-017.js
narcissus/../ecma_2/Exceptions/lexical-018.js
narcissus/../ecma_2/Exceptions/lexical-019.js
narcissus/../ecma_2/Exceptions/lexical-020.js
narcissus/../ecma_2/Exceptions/lexical-021.js
narcissus/../ecma_2/Exceptions/lexical-023.js
narcissus/../ecma_2/Exceptions/lexical-024.js
narcissus/../ecma_2/Exceptions/lexical-025.js
narcissus/../ecma_2/Exceptions/lexical-026.js
narcissus/../ecma_2/Exceptions/lexical-027.js
narcissus/../ecma_2/Exceptions/lexical-028.js
narcissus/../ecma_2/Exceptions/lexical-029.js
narcissus/../ecma_2/Exceptions/lexical-030.js
narcissus/../ecma_2/Exceptions/lexical-031.js
narcissus/../ecma_2/Exceptions/lexical-032.js
narcissus/../ecma_2/Exceptions/lexical-033.js
narcissus/../ecma_2/Exceptions/lexical-034.js
narcissus/../ecma_2/Exceptions/lexical-035.js
narcissus/../ecma_2/Exceptions/lexical-036.js
narcissus/../ecma_2/Exceptions/lexical-037.js
narcissus/../ecma_2/Exceptions/lexical-038.js
narcissus/../ecma_2/Exceptions/lexical-039.js
narcissus/../ecma_2/Exceptions/lexical-040.js
narcissus/../ecma_2/Exceptions/lexical-041.js
narcissus/../ecma_2/Exceptions/lexical-042.js
narcissus/../ecma_2/Exceptions/lexical-047.js
narcissus/../ecma_2/Exceptions/lexical-048.js
narcissus/../ecma_2/Exceptions/lexical-049.js
narcissus/../ecma_2/Exceptions/lexical-050.js
narcissus/../ecma_2/Exceptions/lexical-051.js
narcissus/../ecma_2/Exceptions/lexical-052.js
narcissus/../ecma_2/Exceptions/lexical-053.js
narcissus/../ecma_2/Exceptions/lexical-054.js
narcissus/../ecma_2/Exceptions/number-001.js
narcissus/../ecma_2/Exceptions/number-002.js
narcissus/../ecma_2/Exceptions/number-003.js
narcissus/../ecma_2/Exceptions/statement-001.js
narcissus/../ecma_2/Exceptions/statement-002.js
narcissus/../ecma_2/Exceptions/statement-003.js
narcissus/../ecma_2/Exceptions/statement-004.js
narcissus/../ecma_2/Exceptions/statement-005.js
narcissus/../ecma_2/Exceptions/statement-006.js
narcissus/../ecma_2/Exceptions/statement-007.js
narcissus/../ecma_2/Exceptions/statement-008.js
narcissus/../ecma_2/Exceptions/statement-009.js
narcissus/../ecma_2/Exceptions/string-001.js
narcissus/../ecma_2/Exceptions/string-002.js
narcissus/../ecma_2/FunctionObjects/apply-001-n.js
@ -575,7 +530,6 @@ narcissus/../ecma_3/Array/regress-421325.js
narcissus/../ecma_3/Array/regress-430717.js
narcissus/../ecma_3/Date/15.9.5.4.js
narcissus/../ecma_3/Date/regress-452786.js
narcissus/../ecma_3/Exceptions/15.11.4.4-1.js
narcissus/../ecma_3/Exceptions/binding-001.js
narcissus/../ecma_3/Exceptions/regress-181914.js
narcissus/../ecma_3/Exceptions/regress-95101.js
@ -585,13 +539,13 @@ narcissus/../ecma_3/FunExpr/fe-001-n.js
narcissus/../ecma_3/Function/arguments-001.js
narcissus/../ecma_3/Function/regress-131964.js
narcissus/../ecma_3/Function/regress-313570.js
narcissus/../ecma_3/Function/regress-49286.js
narcissus/../ecma_3/Function/regress-58274.js
narcissus/../ecma_3/Function/regress-85880.js
narcissus/../ecma_3/Function/regress-94506.js
narcissus/../ecma_3/Function/scope-001.js
narcissus/../ecma_3/LexicalConventions/7.4-01.js
narcissus/../ecma_3/LexicalConventions/7.8.3-01.js
narcissus/../ecma_3/LexicalConventions/7.9.1.js
narcissus/../ecma_3/Number/15.7.4.5-1.js
narcissus/../ecma_3/Number/15.7.4.5-2.js
narcissus/../ecma_3/Object/8.6.1-01.js
@ -603,7 +557,6 @@ narcissus/../ecma_3/Object/regress-385393-07.js
narcissus/../ecma_3/Operators/11.13.1-001.js
narcissus/../ecma_3/RegExp/15.10.4.1-5-n.js
narcissus/../ecma_3/RegExp/15.10.4.1-6.js
narcissus/../ecma_3/RegExp/regress-122076.js
narcissus/../ecma_3/RegExp/regress-188206.js
narcissus/../ecma_3/RegExp/regress-223273.js
narcissus/../ecma_3/RegExp/regress-375715-01-n.js
@ -611,7 +564,6 @@ narcissus/../ecma_3/RegExp/regress-375715-04.js
narcissus/../ecma_3/RegExp/regress-436700.js
narcissus/../ecma_3/RegExp/regress-465862.js
narcissus/../ecma_3/RegExp/regress-57631.js
narcissus/../ecma_3/RegExp/regress-98306.js
narcissus/../ecma_3/Regress/regress-385393-04.js
narcissus/../ecma_3/Statements/regress-157509.js
narcissus/../ecma_3/Statements/regress-302439.js
@ -630,9 +582,11 @@ narcissus/../ecma_3/extensions/regress-188206-01.js
narcissus/../ecma_3/extensions/regress-274152.js
narcissus/../ecma_3/extensions/regress-368516.js
narcissus/../ecma_3/extensions/regress-385393-03.js
narcissus/../ecma_3_1/Object/regress-444787.js
narcissus/../ecma_5/Array/toString-01.js
narcissus/../ecma_5/Expressions/11.1.5-01.js
narcissus/../ecma_5/Expressions/named-accessor-function.js
narcissus/../ecma_5/Function/15.3.4.3-01.js
narcissus/../ecma_5/JSON/cyclic-stringify.js
narcissus/../ecma_5/Object/15.2.3.3-01.js
narcissus/../ecma_5/Object/15.2.3.4-01.js
@ -660,6 +614,7 @@ narcissus/../ecma_5/Object/15.2.3.6-redefinition-2-of-4.js
narcissus/../ecma_5/Object/15.2.3.6-redefinition-3-of-4.js
narcissus/../ecma_5/Object/15.2.3.6-redefinition-4-of-4.js
narcissus/../ecma_5/Object/15.2.3.7-01.js
narcissus/../ecma_5/RegExp/15.10.7.5-01.js
narcissus/../ecma_5/Types/8.12.5-01.js
narcissus/../ecma_5/extensions/8.12.5-01.js
narcissus/../ecma_5/extensions/regress-bug567606.js
@ -691,7 +646,6 @@ narcissus/../js1_2/regress/regress-144834.js
narcissus/../js1_3/inherit/proto_10.js
narcissus/../js1_3/inherit/proto_12.js
narcissus/../js1_3/inherit/proto_9.js
narcissus/../js1_4/Eval/regress-531037.js
narcissus/../js1_4/Functions/function-001.js
narcissus/../js1_4/Regress/date-001-n.js
narcissus/../js1_4/Regress/function-004-n.js
@ -746,10 +700,8 @@ narcissus/../js1_5/GC/regress-418128.js
narcissus/../js1_5/GetSet/regress-375976.js
narcissus/../js1_5/LexicalConventions/lexical-001.js
narcissus/../js1_5/LexicalConventions/regress-343675.js
narcissus/../js1_5/LexicalConventions/regress-469940.js
narcissus/../js1_5/Regress/regress-103602.js
narcissus/../js1_5/Regress/regress-104077.js
narcissus/../js1_5/Regress/regress-114491.js
narcissus/../js1_5/Regress/regress-114493.js
narcissus/../js1_5/Regress/regress-115436.js
narcissus/../js1_5/Regress/regress-116228.js
@ -760,23 +712,18 @@ narcissus/../js1_5/Regress/regress-156354.js
narcissus/../js1_5/Regress/regress-167328.js
narcissus/../js1_5/Regress/regress-172699.js
narcissus/../js1_5/Regress/regress-179524.js
narcissus/../js1_5/Regress/regress-192414.js
narcissus/../js1_5/Regress/regress-214761.js
narcissus/../js1_5/Regress/regress-224956.js
narcissus/../js1_5/Regress/regress-230216-2.js
narcissus/../js1_5/Regress/regress-234389.js
narcissus/../js1_5/Regress/regress-238881.js
narcissus/../js1_5/Regress/regress-238945.js
narcissus/../js1_5/Regress/regress-243389-n.js
narcissus/../js1_5/Regress/regress-245113.js
narcissus/../js1_5/Regress/regress-252892.js
narcissus/../js1_5/Regress/regress-253150.js
narcissus/../js1_5/Regress/regress-256501.js
narcissus/../js1_5/Regress/regress-256617.js
narcissus/../js1_5/Regress/regress-281606.js
narcissus/../js1_5/Regress/regress-290575.js
narcissus/../js1_5/Regress/regress-294302.js
narcissus/../js1_5/Regress/regress-299209.js
narcissus/../js1_5/Regress/regress-303213.js
narcissus/../js1_5/Regress/regress-306633.js
narcissus/../js1_5/Regress/regress-306794.js
@ -784,7 +731,6 @@ narcissus/../js1_5/Regress/regress-308566.js
narcissus/../js1_5/Regress/regress-309242.js
narcissus/../js1_5/Regress/regress-310993.js
narcissus/../js1_5/Regress/regress-311071.js
narcissus/../js1_5/Regress/regress-311629.js
narcissus/../js1_5/Regress/regress-312260.js
narcissus/../js1_5/Regress/regress-31255.js
narcissus/../js1_5/Regress/regress-312588.js
@ -804,7 +750,6 @@ narcissus/../js1_5/Regress/regress-334807-04.js
narcissus/../js1_5/Regress/regress-334807-05.js
narcissus/../js1_5/Regress/regress-334807-06.js
narcissus/../js1_5/Regress/regress-336100.js
narcissus/../js1_5/Regress/regress-340369.js
narcissus/../js1_5/Regress/regress-344711-n.js
narcissus/../js1_5/Regress/regress-349648.js
narcissus/../js1_5/Regress/regress-350253.js
@ -812,6 +757,7 @@ narcissus/../js1_5/Regress/regress-350268.js
narcissus/../js1_5/Regress/regress-350415.js
narcissus/../js1_5/Regress/regress-350529.js
narcissus/../js1_5/Regress/regress-351515.js
narcissus/../js1_5/Regress/regress-352009.js
narcissus/../js1_5/Regress/regress-352197.js
narcissus/../js1_5/Regress/regress-352208.js
narcissus/../js1_5/Regress/regress-355556.js
@ -819,16 +765,12 @@ narcissus/../js1_5/Regress/regress-356693.js
narcissus/../js1_5/Regress/regress-360969-05.js
narcissus/../js1_5/Regress/regress-360969-06.js
narcissus/../js1_5/Regress/regress-361617.js
narcissus/../js1_5/Regress/regress-366122.js
narcissus/../js1_5/Regress/regress-372364.js
narcissus/../js1_5/Regress/regress-383674.js
narcissus/../js1_5/Regress/regress-383682.js
narcissus/../js1_5/Regress/regress-407323.js
narcissus/../js1_5/Regress/regress-407957.js
narcissus/../js1_5/Regress/regress-410852.js
narcissus/../js1_5/Regress/regress-416737-01.js
narcissus/../js1_5/Regress/regress-416737-02.js
narcissus/../js1_5/Regress/regress-417893.js
narcissus/../js1_5/Regress/regress-419018.js
narcissus/../js1_5/Regress/regress-420919.js
narcissus/../js1_5/Regress/regress-422348.js
@ -918,9 +860,7 @@ narcissus/../js1_5/Regress/regress-68498-003.js
narcissus/../js1_5/Regress/regress-68498-004.js
narcissus/../js1_5/Regress/regress-89474.js
narcissus/../js1_5/Regress/regress-96128-n.js
narcissus/../js1_5/Regress/regress-96526-002.js
narcissus/../js1_5/Regress/regress-98901.js
narcissus/../js1_5/Scope/regress-181834.js
narcissus/../js1_5/Scope/regress-184107.js
narcissus/../js1_5/Scope/regress-185485.js
narcissus/../js1_5/Scope/regress-446026-01.js
@ -1011,11 +951,8 @@ narcissus/../js1_5/extensions/regress-352261.js
narcissus/../js1_5/extensions/regress-352372.js
narcissus/../js1_5/extensions/regress-353214.js
narcissus/../js1_5/extensions/regress-354297.js
narcissus/../js1_5/extensions/regress-354541-01.js
narcissus/../js1_5/extensions/regress-354541-02.js
narcissus/../js1_5/extensions/regress-354541-03.js
narcissus/../js1_5/extensions/regress-354541-04.js
narcissus/../js1_5/extensions/regress-355497.js
narcissus/../js1_5/extensions/regress-355736.js
narcissus/../js1_5/extensions/regress-358594-01.js
narcissus/../js1_5/extensions/regress-358594-02.js
narcissus/../js1_5/extensions/regress-358594-03.js
@ -1052,9 +989,6 @@ narcissus/../js1_5/extensions/regress-424683-01.js
narcissus/../js1_5/extensions/regress-427196-01.js
narcissus/../js1_5/extensions/regress-429739.js
narcissus/../js1_5/extensions/regress-434837-01.js
narcissus/../js1_5/extensions/regress-435497-01.js
narcissus/../js1_5/extensions/regress-435497-02.js
narcissus/../js1_5/extensions/regress-435497-03.js
narcissus/../js1_5/extensions/regress-452178.js
narcissus/../js1_5/extensions/regress-452338.js
narcissus/../js1_5/extensions/regress-452565.js
@ -1078,11 +1012,8 @@ narcissus/../js1_5/extensions/regress-96284-001.js
narcissus/../js1_5/extensions/regress-96284-002.js
narcissus/../js1_5/extensions/scope-001.js
narcissus/../js1_6/Array/regress-352742-01.js
narcissus/../js1_6/Array/regress-352742-02.js
narcissus/../js1_6/Array/regress-415540.js
narcissus/../js1_6/Regress/regress-301574.js
narcissus/../js1_6/Regress/regress-311157-01.js
narcissus/../js1_6/Regress/regress-311157-02.js
narcissus/../js1_6/Regress/regress-314887.js
narcissus/../js1_6/Regress/regress-350417.js
narcissus/../js1_6/Regress/regress-351795.js
@ -1124,9 +1055,8 @@ narcissus/../js1_7/block/regress-347559.js
narcissus/../js1_7/block/regress-348685.js
narcissus/../js1_7/block/regress-349283.js
narcissus/../js1_7/block/regress-349507.js
narcissus/../js1_7/block/regress-349962.js
narcissus/../js1_7/block/regress-349653.js
narcissus/../js1_7/block/regress-350279.js
narcissus/../js1_7/block/regress-350730.js
narcissus/../js1_7/block/regress-350793-01.js
narcissus/../js1_7/block/regress-351497.js
narcissus/../js1_7/block/regress-351794.js
@ -1139,8 +1069,6 @@ narcissus/../js1_7/block/regress-352616.js
narcissus/../js1_7/block/regress-352624.js
narcissus/../js1_7/block/regress-352786.js
narcissus/../js1_7/block/regress-352907.js
narcissus/../js1_7/block/regress-357754.js
narcissus/../js1_7/block/regress-358508.js
narcissus/../js1_7/block/regress-376410.js
narcissus/../js1_7/block/regress-396900.js
narcissus/../js1_7/block/regress-411279.js
@ -1153,25 +1081,27 @@ narcissus/../js1_7/decompilation/regress-350793-02.js
narcissus/../js1_7/decompilation/regress-350810.js
narcissus/../js1_7/decompilation/regress-351070-03.js
narcissus/../js1_7/decompilation/regress-351496.js
narcissus/../js1_7/decompilation/regress-352008.js
narcissus/../js1_7/decompilation/regress-352015.js
narcissus/../js1_7/decompilation/regress-352068.js
narcissus/../js1_7/decompilation/regress-352079.js
narcissus/../js1_7/decompilation/regress-352217.js
narcissus/../js1_7/decompilation/regress-352269.js
narcissus/../js1_7/decompilation/regress-352272.js
narcissus/../js1_7/decompilation/regress-352283.js
narcissus/../js1_7/decompilation/regress-352415.js
narcissus/../js1_7/decompilation/regress-352441.js
narcissus/../js1_7/decompilation/regress-352732.js
narcissus/../js1_7/decompilation/regress-355049-01.js
narcissus/../js1_7/decompilation/regress-355049-02.js
narcissus/../js1_7/decompilation/regress-355105.js
narcissus/../js1_7/decompilation/regress-355635.js
narcissus/../js1_7/decompilation/regress-356247.js
narcissus/../js1_7/decompilation/regress-374713.js
narcissus/../js1_7/decompilation/regress-375794.js
narcissus/../js1_7/decompilation/regress-379925.js
narcissus/../js1_7/decompilation/regress-380506.js
narcissus/../js1_7/decompilation/regress-410571.js
narcissus/../js1_7/decompilation/regress-429252.js
narcissus/../js1_7/expressions/destructuring-scope.js
narcissus/../js1_7/expressions/regress-346203.js
narcissus/../js1_7/expressions/regress-346645-01.js
narcissus/../js1_7/expressions/regress-346645-02.js
narcissus/../js1_7/expressions/regress-346645-03.js
@ -1179,7 +1109,6 @@ narcissus/../js1_7/expressions/regress-349624.js
narcissus/../js1_7/expressions/regress-349818.js
narcissus/../js1_7/expressions/regress-418051.js
narcissus/../js1_7/expressions/regress-421806.js
narcissus/../js1_7/expressions/regress-451340.js
narcissus/../js1_7/extensions/basic-Iterator.js
narcissus/../js1_7/extensions/basic-for-each.js
narcissus/../js1_7/extensions/basic-for-in.js
@ -1187,10 +1116,8 @@ narcissus/../js1_7/extensions/destructuring-order.js
narcissus/../js1_7/extensions/iterator-ctor.js
narcissus/../js1_7/extensions/regress-346021.js
narcissus/../js1_7/extensions/regress-346642-02.js
narcissus/../js1_7/extensions/regress-346642-06.js
narcissus/../js1_7/extensions/regress-349619.js
narcissus/../js1_7/extensions/regress-350312.js
narcissus/../js1_7/extensions/regress-351070-02.js
narcissus/../js1_7/extensions/regress-351102-03.js
narcissus/../js1_7/extensions/regress-351102-04.js
narcissus/../js1_7/extensions/regress-351102-05.js
@ -1221,7 +1148,6 @@ narcissus/../js1_7/extensions/regress-380933.js
narcissus/../js1_7/extensions/regress-381301.js
narcissus/../js1_7/extensions/regress-381303.js
narcissus/../js1_7/extensions/regress-387955-01.js
narcissus/../js1_7/extensions/regress-387955-02.js
narcissus/../js1_7/extensions/regress-392308.js
narcissus/../js1_7/extensions/regress-429266.js
narcissus/../js1_7/extensions/regress-455982-01.js
@ -1258,9 +1184,7 @@ narcissus/../js1_7/geniter/regress-349023-01.js
narcissus/../js1_7/geniter/regress-349023-02.js
narcissus/../js1_7/geniter/regress-349023-03.js
narcissus/../js1_7/geniter/regress-349362.js
narcissus/../js1_7/geniter/regress-349851.js
narcissus/../js1_7/geniter/regress-350621.js
narcissus/../js1_7/geniter/regress-350809.js
narcissus/../js1_7/geniter/regress-351120.js
narcissus/../js1_7/geniter/regress-351514.js
narcissus/../js1_7/geniter/regress-352197.js
@ -1293,10 +1217,10 @@ narcissus/../js1_7/iterable/regress-355090.js
narcissus/../js1_7/iterable/regress-412467.js
narcissus/../js1_7/iterable/regress-568056.js
narcissus/../js1_7/lexical/regress-336376-01.js
narcissus/../js1_7/lexical/regress-346642-04.js
narcissus/../js1_7/lexical/regress-351515.js
narcissus/../js1_7/regress/regress-351503-01.js
narcissus/../js1_7/regress/regress-351503-02.js
narcissus/../js1_7/regress/regress-352640-03.js
narcissus/../js1_7/regress/regress-352797-02.js
narcissus/../js1_7/regress/regress-352870-01.js
narcissus/../js1_7/regress/regress-352870-02.js
@ -1308,23 +1232,17 @@ narcissus/../js1_7/regress/regress-355832-02.js
narcissus/../js1_7/regress/regress-361566.js
narcissus/../js1_7/regress/regress-363040-01.js
narcissus/../js1_7/regress/regress-363040-02.js
narcissus/../js1_7/regress/regress-369666-01.js
narcissus/../js1_7/regress/regress-369666-02.js
narcissus/../js1_7/regress/regress-372331.js
narcissus/../js1_7/regress/regress-373827-01.js
narcissus/../js1_7/regress/regress-373827-02.js
narcissus/../js1_7/regress/regress-373828.js
narcissus/../js1_7/regress/regress-375695.js
narcissus/../js1_7/regress/regress-379483.js
narcissus/../js1_7/regress/regress-385133-01.js
narcissus/../js1_7/regress/regress-385133-02.js
narcissus/../js1_7/regress/regress-385393-05.js
narcissus/../js1_7/regress/regress-387951.js
narcissus/../js1_7/regress/regress-406477.js
narcissus/../js1_7/regress/regress-407727-01.js
narcissus/../js1_7/regress/regress-407727-02.js
narcissus/../js1_7/regress/regress-407957.js
narcissus/../js1_7/regress/regress-410649.js
narcissus/../js1_7/regress/regress-414553.js
narcissus/../js1_7/regress/regress-416601.js
narcissus/../js1_7/regress/regress-416705.js
@ -1381,7 +1299,6 @@ narcissus/../js1_8/extensions/regress-472450-04.js
narcissus/../js1_8/extensions/regress-473040.js
narcissus/../js1_8/extensions/regress-476414-01.js
narcissus/../js1_8/extensions/regress-476414-02.js
narcissus/../js1_8/extensions/regress-476427.js
narcissus/../js1_8/extensions/regress-476653.js
narcissus/../js1_8/extensions/regress-476869.js
narcissus/../js1_8/extensions/regress-476871-01.js
@ -1404,11 +1321,13 @@ narcissus/../js1_8/regress/regress-433279-01.js
narcissus/../js1_8/regress/regress-433279-02.js
narcissus/../js1_8/regress/regress-433279-03.js
narcissus/../js1_8/regress/regress-452491.js
narcissus/../js1_8/regress/regress-453492.js
narcissus/../js1_8/regress/regress-455981-01.js
narcissus/../js1_8/regress/regress-455981-02.js
narcissus/../js1_8/regress/regress-457065-01.js
narcissus/../js1_8/regress/regress-457065-02.js
narcissus/../js1_8/regress/regress-458076.js
narcissus/../js1_8/regress/regress-459185.js
narcissus/../js1_8/regress/regress-459186.js
narcissus/../js1_8/regress/regress-459389.js
narcissus/../js1_8/regress/regress-461930.js
@ -1447,10 +1366,7 @@ narcissus/../js1_8/regress/regress-465567-02.js
narcissus/../js1_8/regress/regress-465688.js
narcissus/../js1_8/regress/regress-466128.js
narcissus/../js1_8/regress/regress-466787.js
narcissus/../js1_8/regress/regress-467495-01.js
narcissus/../js1_8/regress/regress-467495-02.js
narcissus/../js1_8/regress/regress-467495-03.js
narcissus/../js1_8/regress/regress-467495-04.js
narcissus/../js1_8/regress/regress-467495-05.js
narcissus/../js1_8/regress/regress-468711.js
narcissus/../js1_8/regress/regress-469547.js
@ -1483,6 +1399,7 @@ narcissus/../js1_8_1/decompilation/regress-350991.js
narcissus/../js1_8_1/decompilation/regress-351070-01.js
narcissus/../js1_8_1/decompilation/regress-351336.js
narcissus/../js1_8_1/decompilation/regress-351626.js
narcissus/../js1_8_1/decompilation/regress-352011.js
narcissus/../js1_8_1/decompilation/regress-352022.js
narcissus/../js1_8_1/decompilation/regress-352026.js
narcissus/../js1_8_1/decompilation/regress-352609.js
@ -1503,6 +1420,7 @@ narcissus/../js1_8_1/extensions/regress-477158.js
narcissus/../js1_8_1/extensions/strict-warning.js
narcissus/../js1_8_1/regress/regress-420399.js
narcissus/../js1_8_1/regress/regress-452498-027.js
narcissus/../js1_8_1/regress/regress-452498-038.js
narcissus/../js1_8_1/regress/regress-452498-039.js
narcissus/../js1_8_1/regress/regress-452498-050.js
narcissus/../js1_8_1/regress/regress-452498-051.js
@ -1510,7 +1428,6 @@ narcissus/../js1_8_1/regress/regress-452498-052.js
narcissus/../js1_8_1/regress/regress-452498-053.js
narcissus/../js1_8_1/regress/regress-452498-054.js
narcissus/../js1_8_1/regress/regress-452498-068.js
narcissus/../js1_8_1/regress/regress-452498-073.js
narcissus/../js1_8_1/regress/regress-452498-074.js
narcissus/../js1_8_1/regress/regress-452498-076.js
narcissus/../js1_8_1/regress/regress-452498-077.js
@ -1540,9 +1457,7 @@ narcissus/../js1_8_1/regress/regress-452498-138.js
narcissus/../js1_8_1/regress/regress-452498-139.js
narcissus/../js1_8_1/regress/regress-452498-155.js
narcissus/../js1_8_1/regress/regress-452498-160.js
narcissus/../js1_8_1/regress/regress-452498-168-1.js
narcissus/../js1_8_1/regress/regress-452498-178.js
narcissus/../js1_8_1/regress/regress-452498-184.js
narcissus/../js1_8_1/regress/regress-452498-185.js
narcissus/../js1_8_1/regress/regress-452498-187.js
narcissus/../js1_8_1/regress/regress-452498-191.js
@ -1559,7 +1474,6 @@ narcissus/../js1_8_1/regress/regress-522123.js
narcissus/../js1_8_1/regress/regress-524264.js
narcissus/../js1_8_1/regress/regress-530879.js
narcissus/../js1_8_1/strict/12.2.1.js
narcissus/../js1_8_1/strict/8.7.2.js
narcissus/../js1_8_1/strict/generator-eval-arguments.js
narcissus/../js1_8_1/strict/let-block-eval-arguments.js
narcissus/../js1_8_1/trace/math-trace-tests.js
@ -1579,6 +1493,8 @@ narcissus/../js1_8_1/trace/regress-462459-12.js
narcissus/../js1_8_1/trace/regress-471635.js
narcissus/../js1_8_1/trace/regress-489682.js
narcissus/../js1_8_1/trace/trace-test.js
narcissus/../js1_8_5/extensions/parseInt-octal.js
narcissus/../js1_8_5/extensions/proxy-enumerateOwn-duplicates.js
narcissus/../js1_8_5/extensions/scripted-proxies.js
narcissus/../js1_8_5/extensions/typedarray-prototype.js
narcissus/../js1_8_5/extensions/typedarray.js
@ -1595,3 +1511,5 @@ narcissus/../js1_8_5/regress/regress-560998-1.js
narcissus/../js1_8_5/regress/regress-566549.js
narcissus/../js1_8_5/regress/regress-566914.js
narcissus/../js1_8_5/regress/regress-571014.js
narcissus/../js1_8_5/regress/regress-577648-1.js
narcissus/../js1_8_5/regress/regress-577648-2.js

View File

@ -1,12 +1,13 @@
To run narcissus with jstests.py, change to the js/src/tests/ directory and run
the following command:
the following command (which excludes tests that are particularly slow):
python jstests.py -d -j 4 $OBJDIR/njs -m narcissus.list
python jstests.py -d -j 4 $OBJDIR/njs -m narcissus.list -x slow-narcissus.txt
The js/src/tests/narcissus directory can be used for any tweaks that might be needed
to make Narcissus work properly. Currently, Narcissus is failing a number of
tests. narcissus-failures.txt can be used to ignore those tests.
tests. narcissus-failures.txt can be used to ignore those tests. Note that
narcissus-failures.txt also includes all of the tests from slow-narcissus.txt.
python jstests.py -d -j 4 $OBJDIR/njs -m narcissus.list -x narcissus-failures.txt

View File

@ -0,0 +1,18 @@
narcissus/../ecma/Date/15.9.5.2-2-n.js
narcissus/../ecma/Date/15.9.5.23-3-n.js
narcissus/../ecma/Date/15.9.5.3-1-n.js
narcissus/../ecma/Date/15.9.5.4-2-n.js
narcissus/../ecma/Date/15.9.5.8.js
narcissus/../ecma/Date/dst-offset-caching-1-of-8.js
narcissus/../ecma/Date/dst-offset-caching-2-of-8.js
narcissus/../ecma/Date/dst-offset-caching-3-of-8.js
narcissus/../ecma/Date/dst-offset-caching-4-of-8.js
narcissus/../ecma/Date/dst-offset-caching-5-of-8.js
narcissus/../ecma/Date/dst-offset-caching-6-of-8.js
narcissus/../ecma/Date/dst-offset-caching-7-of-8.js
narcissus/../ecma/Date/dst-offset-caching-8-of-8.js
narcissus/../ecma/Date/15.9.5.11-2.js
narcissus/../ecma/Date/15.9.5.12-2.js
narcissus/../ecma_3/Date/15.9.5.4.js
narcissus/../ecma_3/Date/regress-452786.js
narcissus/../ecma/Date/15.9.5.10-2.js