Add support for bizarro <!-- and --> behavior

Issue #62
This commit is contained in:
Marijn Haverbeke
2013-09-06 10:51:56 +02:00
parent 411b29791b
commit b998d5e22d
3 changed files with 179 additions and 86 deletions

View File

@@ -26283,6 +26283,71 @@ test("{}/=/", {
]
});
test("foo <!--bar\n+baz", {
type: "Program",
start: 0,
end: 16,
body: [
{
type: "ExpressionStatement",
start: 0,
end: 16,
expression: {
type: "BinaryExpression",
start: 0,
end: 16,
left: {
type: "Identifier",
start: 0,
end: 3,
name: "foo"
},
operator: "+",
right: {
type: "Identifier",
start: 13,
end: 16,
name: "baz"
}
}
}
]
});
test("x = y-->10;\n --> nothing", {
type: "Program",
body: [
{
type: "ExpressionStatement",
expression: {
type: "AssignmentExpression",
operator: "=",
left: {
type: "Identifier",
name: "x"
},
right: {
type: "BinaryExpression",
left: {
type: "UpdateExpression",
operator: "--",
prefix: false,
argument: {
type: "Identifier",
name: "y"
}
},
operator: ">",
right: {
type: "Literal",
value: 10
}
}
}
}
]
});
// Failure tests
testFail("{",