Conflicts:
	acorn.js
	package.json
This commit is contained in:
Sebastian McKenzie 2014-11-15 11:34:27 +11:00
commit 61810eef8d
3 changed files with 132 additions and 21 deletions

View File

@ -472,9 +472,8 @@
parenL: _parenL, parenR: _parenR, comma: _comma, semi: _semi, colon: _colon,
dot: _dot, ellipsis: _ellipsis, question: _question, slash: _slash, eq: _eq,
name: _name, eof: _eof, num: _num, regexp: _regexp, string: _string,
arrow: _arrow, bquote: _bquote, dollarBraceL: _dollarBraceL,
xjsName: _xjsName, xjsText: _xjsText,
star: _star, assign: _assign};
arrow: _arrow, bquote: _bquote, dollarBraceL: _dollarBraceL, star: _star,
assign: _assign, xjsName: _xjsName, xjsText: _xjsText};
for (var kw in keywordTypes) exports.tokTypes["_" + kw] = keywordTypes[kw];
// This is a trick taken from Esprima. It turns out that, on
@ -1015,7 +1014,7 @@
var value = new RegExp(content, mods);
} catch (err) {
value = null;
}
}
return finishToken(_regexp, {pattern: content, flags: mods, value: value});
}
@ -2374,8 +2373,8 @@
nodeType = "SpreadElement";
} else {
nodeType = update ? "UpdateExpression" : "UnaryExpression";
node.operator = tokVal;
node.prefix = true;
node.operator = tokVal;
node.prefix = true;
}
tokRegexpAllowed = true;
next();
@ -3261,6 +3260,7 @@
inXJSTag = false;
next();
if (tokType !== _ellipsis) unexpected();
var node = parseMaybeUnary();
inXJSTag = origInXJSTag;
@ -3359,6 +3359,9 @@
inXJSChild = origInXJSChild;
inXJSTag = origInXJSTag;
tokRegexpAllowed = false;
if (inXJSChild) {
tokPos = tokEnd;
}
expect(_gt);
return finishNode(node, "XJSClosingElement");
}

View File

@ -65,10 +65,10 @@
}
};
function report(state, code, message) {
function report(state, code, message) {
if (state != "ok") {++stats.failed; log(code, message);}
++stats.testsRun;
}
}
group("Errors");
@ -76,7 +76,7 @@
group(name);
var mode = modes[name];
stats = mode.stats = {testsRun: 0, failed: 0};
var t0 = +new Date;
var t0 = +new Date;
driver.runTests(mode.config, report);
mode.stats.duration = +new Date - t0;
groupEnd();
@ -104,8 +104,8 @@
groupEnd();
if (total.failed && typeof process === "object") {
process.stdout.write("", function() {
process.exit(1);
});
process.stdout.write("", function() {
process.exit(1);
});
}
})();

View File

@ -3199,6 +3199,111 @@ var fbTestFixture = {
]
}
}
},
'Regression': {
'<p>foo <a href="test"> bar</a> baz</p> ;': {
type: "ExpressionStatement",
start: 0,
end: 40,
expression: {
type: "XJSElement",
start: 0,
end: 38,
openingElement: {
type: "XJSOpeningElement",
start: 0,
end: 3,
attributes: [],
name: {
type: "XJSIdentifier",
start: 1,
end: 2,
name: "p"
},
selfClosing: false
},
closingElement: {
type: "XJSClosingElement",
start: 34,
end: 38,
name: {
type: "XJSIdentifier",
start: 36,
end: 37,
name: "p"
}
},
children: [
{
type: "Literal",
start: 3,
end: 7,
value: "foo ",
raw: "foo "
},
{
type: "XJSElement",
start: 7,
end: 30,
openingElement: {
type: "XJSOpeningElement",
start: 7,
end: 22,
attributes: [{
type: "XJSAttribute",
start: 10,
end: 21,
name: {
type: "XJSIdentifier",
start: 10,
end: 14,
name: "href"
},
value: {
type: "Literal",
start: 15,
end: 21,
value: "test",
raw: "\"test\""
}
}],
name: {
type: "XJSIdentifier",
start: 8,
end: 9,
name: "a"
},
selfClosing: false
},
closingElement: {
type: "XJSClosingElement",
start: 26,
end: 30,
name: {
type: "XJSIdentifier",
start: 28,
end: 29,
name: "a"
}
},
children: [{
type: "Literal",
start: 22,
end: 26,
value: " bar",
raw: " bar"
}]
},
{
type: "Literal",
start: 30,
end: 34,
value: " baz",
raw: " baz"
}
]
}
}
}
};
@ -3206,13 +3311,16 @@ if (typeof exports !== "undefined") {
var test = require("./driver.js").test;
}
for (var code in fbTestFixture.XJS) {
test(code, {
type: 'Program',
body: [fbTestFixture.XJS[code]]
}, {
ecmaVersion: 6,
locations: true,
ranges: true
});
for (var ns in fbTestFixture) {
ns = fbTestFixture[ns];
for (var code in ns) {
test(code, {
type: 'Program',
body: [ns[code]]
}, {
ecmaVersion: 6,
locations: true,
ranges: true
});
}
}