Socket
Socket
Sign inDemoInstall

acorn-jsx

Package Overview
Dependencies
0
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.6.1 to 0.7.1-2

.gitattributes

41

acorn_loose.js

@@ -89,3 +89,3 @@ // Acorn: Loose parser

if (/unterminated/i.test(msg)) {
pos = lineEnd(e.pos);
pos = lineEnd(e.pos + 1);
if (/string/.test(msg)) {

@@ -129,24 +129,19 @@ replace = {start: e.pos, end: pos, type: tt.string, value: input.slice(e.pos + 1, pos)};

function resetTo(pos) {
var ch = input.charAt(pos - 1);
var reAllowed = !ch || /[\[\{\(,;:?\/*=+\-~!|&%^<>]/.test(ch) ||
/[enwfd]/.test(ch) && /\b(keywords|case|else|return|throw|new|in|(instance|type)of|delete|void)$/.test(input.slice(pos - 10, pos));
fetchToken.jumpTo(pos, reAllowed);
}
function copyToken(token) {
var copy = {start: token.start, end: token.end, type: token.type, value: token.value};
if (options.locations) {
copy.startLoc = token.startLoc;
copy.endLoc = token.endLoc;
for (;;) {
try {
var ch = input.charAt(pos - 1);
var reAllowed = !ch || /[\[\{\(,;:?\/*=+\-~!|&%^<>]/.test(ch) ||
/[enwfd]/.test(ch) && /\b(keywords|case|else|return|throw|new|in|(instance|type)of|delete|void)$/.test(input.slice(pos - 10, pos));
return fetchToken.jumpTo(pos, reAllowed);
} catch(e) {
if (!(e instanceof SyntaxError && /unterminated comment/i.test(e.message))) throw e;
pos = lineEnd(e.pos + 1);
if (pos >= input.length) return;
}
}
return copy;
}
function lookAhead(n) {
// Copy token objects, because fetchToken will overwrite the one
// it returns, and in this case we still need it
if (!ahead.length)
token = copyToken(token);
while (n > ahead.length)
ahead.push(copyToken(readToken()));
ahead.push(readToken());
return ahead[n-1];

@@ -711,10 +706,10 @@ }

if (!name) { if (isDummy(parseExpression(true))) next(); eat(tt.comma); continue; }
var prop = {key: name}, isGetSet = false, kind;
var prop = startNode();
prop.key = name;
if (eat(tt.colon)) {
prop.value = parseExpression(true);
kind = prop.kind = "init";
prop.kind = "init";
} else if (options.ecmaVersion >= 5 && prop.key.type === "Identifier" &&
(prop.key.name === "get" || prop.key.name === "set")) {
isGetSet = true;
kind = prop.kind = prop.key.name;
prop.kind = prop.key.name;
prop.key = parsePropertyName() || dummyIdent();

@@ -728,3 +723,3 @@ prop.value = parseFunction(startNode(), false);

node.properties.push(prop);
node.properties.push(finishNode(prop, "Property"));
eat(tt.comma);

@@ -731,0 +726,0 @@ }

@@ -5,3 +5,3 @@ {

"main": "acorn.js",
"version": "0.6.1",
"version": "0.7.1-2",
"maintainers": [

@@ -25,3 +25,5 @@ {

"scripts": {"test": "node test/run.js"},
"bin": {"acorn-jsx": "./bin/acorn"}
"bin": {"acorn-jsx": "./bin/acorn"},
"devDependencies": {"regenerate": "~0.6.2",
"unicode-7.0.0": "~0.1.5"}
}

@@ -1,17 +0,17 @@

# Acorn (JSX edition)
# Acorn-JSX
[![Build Status](https://travis-ci.org/RReverser/acorn.svg?branch=master)](https://travis-ci.org/RReverser/acorn)
This is modification of [Acorn][acorn] - a tiny, fast JavaScript parser, written completely in JavaScript.
It was forked to create experimental, alternative, faster [React.js JSX][jsx] parser by integrating pieces
It was forked to create experimental alternative, faster [React.js JSX][jsx] parser by integrating pieces
of code from official parser, modified to match Acorn's parsing logic.
According to [benchmarks](http://marijnhaverbeke.nl/acorn/test/bench.html), Acorn is 5x faster than Esprima
when parsing code with location tracking (call it "source maps enabled mode"), and JSX extensions almost don't
affect those numbers. However, [esprima-fb](https://github.com/facebook/esprima) is forked&maintained from
harmony branch of esprima which is being heavily optimized and currently `acorn-jsx` is only 1.5-2x faster than
`esprima-fb`.
According to [benchmarks](test/bench.html), Acorn-JSX is 2x faster than official [Esprima-based parser][esprima-fb]
when location tracking is turned on in both (call it "source maps enabled mode").
At the same time, it consumes all the ES6+JSX syntax that can be consumed by Esprima-FB
(this is proved by [official tests](test/tests-jsx.js)).
Currently, it consumes all the ES5+JSX syntax that can be consumed by official [Esprima-based parser][esprima-fb].
However, official parser can consume ES6 syntax as well, and is maintained by authors of React.js itself, so it's
preferred to be used in real projects.
However, Esprima-FB is maintained by authors of React.js itself,
so it's recommended to be used in production code.

@@ -22,2 +22,6 @@ [acorn]: http://marijnhaverbeke.nl/acorn/

## Transpiler
Please note that this tool only parses source code to JSX AST. If you want to convert result to JS AST or directly to JS code and source map, check out [jsx-transpiler](https://github.com/RReverser/jsx-transpiler).
## Installation

@@ -69,4 +73,3 @@

either 3, 5, or 6. This influences support for strict mode, the set
of reserved words, and support for getters and setter. Default is 5.
ES6 is only partially supported.
of reserved words, and support for new syntax features. Default is 5.

@@ -94,2 +97,10 @@ - **strictSemicolons**: If `true`, prevents the parser from doing

- **onToken**: If a function is passed for this option, each found
token will be passed in same format as `tokenize()` returns.
If array is passed, each found token is pushed to it.
Note that you are not allowed to call the parser from the
callback—that will corrupt its internal state.
- **onComment**: If a function is passed for this option, whenever a

@@ -109,2 +120,14 @@ comment is encountered the function will be called with the

If array is passed for this option, each found comment is pushed
to it as object in Esprima format:
```javascript
{
"type": "Line" | "Block",
"value": "comment text",
"range": ...,
"loc": ...
}
```
Note that you are not allowed to call the parser from the

@@ -127,3 +150,3 @@ callback—that will corrupt its internal state.

- **sourceFile**: When the `locations` option is `true`, you can pass
this option to add a `sourceFile` attribute in every node’s `loc`
this option to add a `source` attribute in every node’s `loc`
object. Note that the contents of this option are not examined or

@@ -133,4 +156,4 @@ processed in any way; you are free to use whatever format you

- **directSourceFile**: Like `sourceFile`, but the property will be
added directly to the nodes, rather than to a `loc` object.
- **directSourceFile**: Like `sourceFile`, but a `sourceFile` property
will be added directly to the nodes, rather than the `loc` object.

@@ -147,5 +170,4 @@ [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678

token, and returns a `{start, end, type, value}` object (with added
`startLoc` and `endLoc` properties when the `locations` option is
enabled). This object will be reused (updated) for each token, so you
can't count on it staying stable.
`loc` property when the `locations` option is enabled and `range`
property when the `ranges` option is enabled).

@@ -155,2 +177,30 @@ **tokTypes** holds an object mapping names to the token type objects

#### Note on using with [Escodegen][escodegen]
Escodegen supports generating comments from AST, attached in
Esprima-specific format. In order to simulate same format in
Acorn, consider following example:
```javascript
var comments = [], tokens = [];
var ast = acorn.parse('var x = 42; // answer', {
// collect ranges for each node
ranges: true,
// collect comments in Esprima's format
onComment: comments,
// collect token ranges
onToken: tokens
});
// attach comments using collected information
escodegen.attachComments(ast, comments, tokens);
// generate code
console.log(escodegen.generate(ast, {comment: true}));
// > 'var x = 42; // answer'
```
[escodegen]: https://github.com/Constellation/escodegen
### acorn_loose.js ###

@@ -228,3 +278,3 @@

- `--ecma3|--ecma5`: Sets the ECMAScript version to parse. Default is
- `--ecma3|--ecma5|--ecma6`: Sets the ECMAScript version to parse. Default is
version 5.

@@ -231,0 +281,0 @@

@@ -5,4 +5,4 @@ (function(exports) {

exports.test = function(code, ast, options) {
tests.push({code: code, ast: ast, options: options});
exports.test = function(code, ast, options, comments) {
tests.push({code: code, ast: ast, options: options, comments: comments});
};

@@ -17,6 +17,22 @@ exports.testFail = function(code, message, options) {

exports.runTests = function(callback) {
var opts = {locations: true};
var comments;
function onComment(block, text, start, end, startLoc, endLoc) {
comments.push({
block: block,
text: text,
start: start,
end: end,
startLoc: { line: startLoc.line, column: startLoc.column },
endLoc: { line: endLoc.line, column: endLoc.column }
});
}
var opts = {locations: true, onComment: onComment};
for (var i = 0; i < tests.length; ++i) {
var test = tests[i];
try {
comments = [];
if (test.options && !test.options.onComment) test.options.onComment = onComment;
var ast = acorn.parse(test.code, test.options || opts);

@@ -32,2 +48,4 @@ if (test.error) callback("fail", test.code,

var mis = misMatch(test.ast, ast);
if (mis) callback("fail", test.code, mis);
if (test.comments) mis = misMatch(test.comments, comments);
if (!mis) callback("ok", test.code);

@@ -34,0 +52,0 @@ else callback("fail", test.code, mis);

var driver = require("./driver.js");
require("./tests.js");
require("./tests-harmony.js");
require("./tests-jsx.js");

@@ -13,3 +15,10 @@ var testsRun = 0, failed = 0;

console.log(testsRun + " tests run in " + (+new Date - t0) + "ms");
if (failed) console.log(failed + " failures.");
else console.log("All passed.");
if (failed) {
console.log(failed + " failures.");
process.stdout.write("", function() {
process.exit(1);
});
} else {
console.log("All passed.");
}
// React JSX tests
if (typeof exports !== "undefined") {
var test = require("./driver.js").test;
}
// Simply taken from esprima-fb/fbtest.js
var fbTestFixture = {
'<a />': {
type: "ExpressionStatement",
expression: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "a",
range: [1, 2],
// Taken and adapted from esprima-fb/fbtest.js.
'XJS': {
'<a />': {
type: "ExpressionStatement",
expression: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "a",
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
selfClosing: true,
attributes: [],
range: [0, 5],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
selfClosing: true,
attributes: [],
closingElement: null,
children: [],
range: [0, 5],

@@ -32,3 +37,2 @@ loc: {

},
children: [],
range: [0, 5],

@@ -40,44 +44,9 @@ loc: {

},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
'<n:a n:v />': {
type: 'ExpressionStatement',
expression: {
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSNamespacedName',
namespace: {
type: 'XJSIdentifier',
name: 'n',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
'<n:a n:v />': {
type: 'ExpressionStatement',
expression: {
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSIdentifier',
name: 'a',
range: [3, 4],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
}
},
range: [1, 4],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 4 }
}
},
selfClosing: true,
attributes: [{
type: 'XJSAttribute',
name: {
type: 'XJSNamespacedName',

@@ -87,6 +56,6 @@ namespace: {

name: 'n',
range: [5, 6],
range: [1, 2],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}

@@ -96,9 +65,45 @@ },

type: 'XJSIdentifier',
name: 'v',
range: [7, 8],
name: 'a',
range: [3, 4],
loc: {
start: { line: 1, column: 7 },
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
}
},
range: [1, 4],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 4 }
}
},
selfClosing: true,
attributes: [{
type: 'XJSAttribute',
name: {
type: 'XJSNamespacedName',
namespace: {
type: 'XJSIdentifier',
name: 'n',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
name: {
type: 'XJSIdentifier',
name: 'v',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
},
range: [5, 8],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 8 }
}
},
value: null,
range: [5, 8],

@@ -109,9 +114,11 @@ loc: {

}
},
range: [5, 8],
}],
range: [0, 11],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 8 }
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
}],
},
closingElement: null,
children: [],
range: [0, 11],

@@ -123,3 +130,2 @@ loc: {

},
children: [],
range: [0, 11],

@@ -131,164 +137,120 @@ loc: {

},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
'<a n:foo="bar"> {value} <b><c /></b></a>': {
type: 'ExpressionStatement',
expression: {
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSIdentifier',
name: 'a',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
selfClosing: false,
attributes: [{
type: 'XJSAttribute',
'<a n:foo="bar"> {value} <b><c /></b></a>': {
type: 'ExpressionStatement',
expression: {
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSNamespacedName',
namespace: {
type: 'XJSIdentifier',
name: 'n',
range: [3, 4],
type: 'XJSIdentifier',
name: 'a',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
selfClosing: false,
attributes: [{
type: 'XJSAttribute',
name: {
type: 'XJSNamespacedName',
namespace: {
type: 'XJSIdentifier',
name: 'n',
range: [3, 4],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
}
},
name: {
type: 'XJSIdentifier',
name: 'foo',
range: [5, 8],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 8 }
}
},
range: [3, 8],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
end: { line: 1, column: 8 }
}
},
name: {
type: 'XJSIdentifier',
name: 'foo',
range: [5, 8],
value: {
type: 'Literal',
value: 'bar',
raw: '"bar"',
range: [9, 14],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 8 }
start: { line: 1, column: 9 },
end: { line: 1, column: 14 }
}
},
range: [3, 8],
range: [3, 14],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 8 }
}
},
value: {
type: 'Literal',
value: 'bar',
raw: '"bar"',
range: [9, 14],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 14 }
}
},
range: [3, 14],
}],
range: [0, 15],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 14 }
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
}],
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
closingElement: {
type: 'XJSClosingElement',
name: {
type: 'XJSIdentifier',
name: 'a',
range: [38, 39],
loc: {
start: { line: 1, column: 38 },
end: { line: 1, column: 39 }
}
},
range: [36, 40],
loc: {
start: { line: 1, column: 36 },
end: { line: 1, column: 40 }
}
},
children: [{
type: 'Literal',
value: ' ',
raw: ' ',
range: [15, 16],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 16 }
}
}, {
type: 'XJSExpressionContainer',
expression: {
type: 'Identifier',
name: 'value',
range: [17, 22],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 22 }
}
},
range: [16, 23],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 23 }
}
}, {
type: 'Literal',
value: ' ',
raw: ' ',
range: [23, 24],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 24 }
}
}, {
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
closingElement: {
type: 'XJSClosingElement',
name: {
type: 'XJSIdentifier',
name: 'b',
range: [25, 26],
name: 'a',
range: [38, 39],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 26 }
start: { line: 1, column: 38 },
end: { line: 1, column: 39 }
}
},
selfClosing: false,
attributes: [],
range: [24, 27],
range: [36, 40],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 27 }
start: { line: 1, column: 36 },
end: { line: 1, column: 40 }
}
},
closingElement: {
type: 'XJSClosingElement',
name: {
type: 'XJSIdentifier',
name: 'b',
range: [34, 35],
children: [{
type: 'Literal',
value: ' ',
raw: ' ',
range: [15, 16],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 16 }
}
}, {
type: 'XJSExpressionContainer',
expression: {
type: 'Identifier',
name: 'value',
range: [17, 22],
loc: {
start: { line: 1, column: 34 },
end: { line: 1, column: 35 }
start: { line: 1, column: 17 },
end: { line: 1, column: 22 }
}
},
range: [32, 36],
range: [16, 23],
loc: {
start: { line: 1, column: 32 },
end: { line: 1, column: 36 }
start: { line: 1, column: 16 },
end: { line: 1, column: 23 }
}
},
children: [{
}, {
type: 'Literal',
value: ' ',
raw: ' ',
range: [23, 24],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 24 }
}
}, {
type: 'XJSElement',

@@ -299,11 +261,57 @@ openingElement: {

type: 'XJSIdentifier',
name: 'c',
range: [28, 29],
name: 'b',
range: [25, 26],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 29 }
start: { line: 1, column: 25 },
end: { line: 1, column: 26 }
}
},
selfClosing: true,
selfClosing: false,
attributes: [],
range: [24, 27],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 27 }
}
},
closingElement: {
type: 'XJSClosingElement',
name: {
type: 'XJSIdentifier',
name: 'b',
range: [34, 35],
loc: {
start: { line: 1, column: 34 },
end: { line: 1, column: 35 }
}
},
range: [32, 36],
loc: {
start: { line: 1, column: 32 },
end: { line: 1, column: 36 }
}
},
children: [{
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSIdentifier',
name: 'c',
range: [28, 29],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 29 }
}
},
selfClosing: true,
attributes: [],
range: [27, 32],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 32 }
}
},
closingElement: null,
children: [],
range: [27, 32],

@@ -314,16 +322,15 @@ loc: {

}
},
children: [],
range: [27, 32],
}],
range: [24, 36],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 32 }
start: { line: 1, column: 24 },
end: { line: 1, column: 36 }
}
}],
range: [24, 36],
range: [0, 40],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 36 }
start: { line: 1, column: 0 },
end: { line: 1, column: 40 }
}
}],
},
range: [0, 40],

@@ -335,115 +342,117 @@ loc: {

},
range: [0, 40],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 40 }
}
},
'<a b={" "} c=" " d="&amp;" />': {
type: "ExpressionStatement",
expression: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "a",
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
selfClosing: true,
attributes: [
{
type: "XJSAttribute",
name: {
type: "XJSIdentifier",
name: "b",
range: [3, 4],
'<a b={" "} c=" " d="&amp;" />': {
type: "ExpressionStatement",
expression: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "a",
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
selfClosing: true,
attributes: [
{
type: "XJSAttribute",
name: {
type: "XJSIdentifier",
name: "b",
range: [3, 4],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
}
},
value: {
type: "XJSExpressionContainer",
expression: {
type: "Literal",
value: " ",
raw: "\" \"",
range: [6, 9],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 9 }
}
},
range: [5, 10],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 10 }
}
},
range: [3, 10],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
end: { line: 1, column: 10 }
}
},
value: {
type: "XJSExpressionContainer",
expression: {
{
type: "XJSAttribute",
name: {
type: "XJSIdentifier",
name: "c",
range: [11, 12],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 12 }
}
},
value: {
type: "Literal",
value: " ",
raw: "\" \"",
range: [6, 9],
range: [13, 16],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 9 }
start: { line: 1, column: 13 },
end: { line: 1, column: 16 }
}
},
range: [5, 10],
range: [11, 16],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 10 }
}
},
range: [3, 10],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 10 }
}
},
{
type: "XJSAttribute",
name: {
type: "XJSIdentifier",
name: "c",
range: [11, 12],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 12 }
}
},
value: {
type: "Literal",
value: " ",
raw: "\" \"",
range: [13, 16],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 16 }
}
},
range: [11, 16],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 16 }
}
},
{
type: "XJSAttribute",
name: {
type: "XJSIdentifier",
name: "d",
range: [17, 18],
{
type: "XJSAttribute",
name: {
type: "XJSIdentifier",
name: "d",
range: [17, 18],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 18 }
}
},
value: {
type: "Literal",
value: "&",
raw: "\"&amp;\"",
range: [19, 26],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 26 }
}
},
range: [17, 26],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 18 }
}
},
value: {
type: "Literal",
value: "&",
raw: "\"&amp;\"",
range: [19, 26],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 26 }
}
},
range: [17, 26],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 26 }
}
],
range: [0, 29],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 29 }
}
],
},
closingElement: null,
children: [],
range: [0, 29],

@@ -455,3 +464,2 @@ loc: {

},
children: [],
range: [0, 29],

@@ -463,20 +471,31 @@ loc: {

},
range: [0, 29],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 29 }
}
},
'<a\n/>': {
type: "ExpressionStatement",
expression: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "a",
'<a\n/>': {
type: "ExpressionStatement",
expression: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "a",
range: [
1,
2
],
loc: {
start: {
line: 1,
column: 1
},
end: {
line: 1,
column: 2
}
}
},
selfClosing: true,
attributes: [],
range: [
1,
2
0,
5
],

@@ -486,6 +505,6 @@ loc: {

line: 1,
column: 1
column: 0
},
end: {
line: 1,
line: 2,
column: 2

@@ -495,4 +514,4 @@ }

},
selfClosing: true,
attributes: [],
closingElement: null,
children: [],
range: [

@@ -513,3 +532,2 @@ 0,

},
children: [],
range: [

@@ -530,29 +548,31 @@ 0,

},
range: [
0,
5
],
loc: {
start: {
line: 1,
column: 0
},
end: {
line: 2,
column: 2
}
}
},
'<日本語></日本語>': {
type: "ExpressionStatement",
expression: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "日本語",
'<日本語></日本語>': {
type: "ExpressionStatement",
expression: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "日本語",
range: [
1,
4
],
loc: {
start: {
line: 1,
column: 1
},
end: {
line: 1,
column: 4
}
}
},
selfClosing: false,
attributes: [],
range: [
1,
4
0,
5
],

@@ -562,35 +582,33 @@ loc: {

line: 1,
column: 1
column: 0
},
end: {
line: 1,
column: 4
column: 5
}
}
},
selfClosing: false,
attributes: [],
range: [
0,
5
],
loc: {
start: {
line: 1,
column: 0
closingElement: {
type: "XJSClosingElement",
name: {
type: "XJSIdentifier",
name: "日本語",
range: [
7,
10
],
loc: {
start: {
line: 1,
column: 7
},
end: {
line: 1,
column: 10
}
}
},
end: {
line: 1,
column: 5
}
}
},
closingElement: {
type: "XJSClosingElement",
name: {
type: "XJSIdentifier",
name: "日本語",
range: [
7,
10
5,
11
],

@@ -600,12 +618,13 @@ loc: {

line: 1,
column: 7
column: 5
},
end: {
line: 1,
column: 10
column: 11
}
}
},
children: [],
range: [
5,
0,
11

@@ -616,3 +635,3 @@ ],

line: 1,
column: 5
column: 0
},

@@ -625,3 +644,2 @@ end: {

},
children: [],
range: [

@@ -642,52 +660,71 @@ 0,

},
range: [
0,
11
],
loc: {
start: {
line: 1,
column: 0
},
end: {
line: 1,
column: 11
}
}
},
'<AbC-def\n test="&#x0026;&#38;">\nbar\nbaz\r\n</AbC-def>': {
type: "ExpressionStatement",
expression: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "AbC-def",
range: [
1,
8
],
loc: {
start: {
line: 1,
column: 1
},
end: {
line: 1,
column: 8
'<AbC-def\n test="&#x0026;&#38;">\nbar\nbaz\n</AbC-def>': {
type: "ExpressionStatement",
expression: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "AbC-def",
range: [
1,
8
],
loc: {
start: {
line: 1,
column: 1
},
end: {
line: 1,
column: 8
}
}
}
},
selfClosing: false,
attributes: [
{
type: "XJSAttribute",
name: {
type: "XJSIdentifier",
name: "test",
},
selfClosing: false,
attributes: [
{
type: "XJSAttribute",
name: {
type: "XJSIdentifier",
name: "test",
range: [
11,
15
],
loc: {
start: {
line: 2,
column: 2
},
end: {
line: 2,
column: 6
}
}
},
value: {
type: "Literal",
value: "&&",
raw: "\"&#x0026;&#38;\"",
range: [
16,
31
],
loc: {
start: {
line: 2,
column: 7
},
end: {
line: 2,
column: 22
}
}
},
range: [
11,
15
31
],

@@ -701,63 +738,44 @@ loc: {

line: 2,
column: 6
}
}
},
value: {
type: "Literal",
value: "&&",
raw: "\"&#x0026;&#38;\"",
range: [
16,
31
],
loc: {
start: {
line: 2,
column: 7
},
end: {
line: 2,
column: 22
}
}
}
],
range: [
0,
32
],
loc: {
start: {
line: 1,
column: 0
},
end: {
line: 2,
column: 23
}
}
},
closingElement: {
type: "XJSClosingElement",
name: {
type: "XJSIdentifier",
name: "AbC-def",
range: [
11,
31
43,
50
],
loc: {
start: {
line: 2,
line: 5,
column: 2
},
end: {
line: 2,
column: 22
line: 5,
column: 9
}
}
}
],
range: [
0,
32
],
loc: {
start: {
line: 1,
column: 0
},
end: {
line: 2,
column: 23
}
}
},
closingElement: {
type: "XJSClosingElement",
name: {
type: "XJSIdentifier",
name: "AbC-def",
range: [
44,
41,
51

@@ -768,17 +786,38 @@ ],

line: 5,
column: 2
column: 0
},
end: {
line: 5,
column: 9
column: 10
}
}
},
children: [
{
type: "Literal",
value: "\nbar\nbaz\n",
raw: "\nbar\nbaz\n",
range: [
32,
41
],
loc: {
start: {
line: 2,
column: 23
},
end: {
line: 5,
column: 0
}
}
}
],
range: [
42,
52
0,
51
],
loc: {
start: {
line: 5,
line: 1,
column: 0

@@ -792,26 +831,5 @@ },

},
children: [
{
type: "Literal",
value: "\nbar\nbaz\r\n",
raw: "\nbar\nbaz\r\n",
range: [
32,
42
],
loc: {
start: {
line: 2,
column: 23
},
end: {
line: 5,
column: 0
}
}
}
],
range: [
0,
52
51
],

@@ -829,96 +847,98 @@ loc: {

},
range: [
0,
52
],
loc: {
start: {
line: 1,
column: 0
},
end: {
line: 5,
column: 10
}
}
},
'<a b={x ? <c /> : <d />} />': {
type: "ExpressionStatement",
expression: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "a",
range: [
1,
2
],
loc: {
start: {
line: 1,
column: 1
},
end: {
line: 1,
column: 2
'<a b={x ? <c /> : <d />} />': {
type: "ExpressionStatement",
expression: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "a",
range: [
1,
2
],
loc: {
start: {
line: 1,
column: 1
},
end: {
line: 1,
column: 2
}
}
}
},
selfClosing: true,
attributes: [
{
type: "XJSAttribute",
name: {
type: "XJSIdentifier",
name: "b",
range: [
3,
4
],
loc: {
start: {
line: 1,
column: 3
},
end: {
line: 1,
column: 4
},
selfClosing: true,
attributes: [
{
type: "XJSAttribute",
name: {
type: "XJSIdentifier",
name: "b",
range: [
3,
4
],
loc: {
start: {
line: 1,
column: 3
},
end: {
line: 1,
column: 4
}
}
}
},
value: {
type: "XJSExpressionContainer",
expression: {
type: "ConditionalExpression",
test: {
type: "Identifier",
name: "x",
range: [
6,
7
],
loc: {
start: {
line: 1,
column: 6
},
end: {
line: 1,
column: 7
},
value: {
type: "XJSExpressionContainer",
expression: {
type: "ConditionalExpression",
test: {
type: "Identifier",
name: "x",
range: [
6,
7
],
loc: {
start: {
line: 1,
column: 6
},
end: {
line: 1,
column: 7
}
}
}
},
consequent: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "c",
},
consequent: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "c",
range: [
11,
12
],
loc: {
start: {
line: 1,
column: 11
},
end: {
line: 1,
column: 12
}
}
},
selfClosing: true,
attributes: [],
range: [
11,
12
10,
15
],

@@ -928,12 +948,12 @@ loc: {

line: 1,
column: 11
column: 10
},
end: {
line: 1,
column: 12
column: 15
}
}
},
selfClosing: true,
attributes: [],
closingElement: null,
children: [],
range: [

@@ -954,28 +974,29 @@ 10,

},
children: [],
range: [
10,
15
],
loc: {
start: {
line: 1,
column: 10
},
end: {
line: 1,
column: 15
}
}
},
alternate: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "d",
alternate: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "d",
range: [
19,
20
],
loc: {
start: {
line: 1,
column: 19
},
end: {
line: 1,
column: 20
}
}
},
selfClosing: true,
attributes: [],
range: [
19,
20
18,
23
],

@@ -985,12 +1006,12 @@ loc: {

line: 1,
column: 19
column: 18
},
end: {
line: 1,
column: 20
column: 23
}
}
},
selfClosing: true,
attributes: [],
closingElement: null,
children: [],
range: [

@@ -1011,5 +1032,4 @@ 18,

},
children: [],
range: [
18,
6,
23

@@ -1020,3 +1040,3 @@ ],

line: 1,
column: 18
column: 6
},

@@ -1030,4 +1050,4 @@ end: {

range: [
6,
23
5,
24
],

@@ -1037,7 +1057,7 @@ loc: {

line: 1,
column: 6
column: 5
},
end: {
line: 1,
column: 23
column: 24
}

@@ -1047,3 +1067,3 @@ }

range: [
5,
3,
24

@@ -1054,3 +1074,3 @@ ],

line: 1,
column: 5
column: 3
},

@@ -1062,19 +1082,21 @@ end: {

}
}
],
range: [
0,
27
],
loc: {
start: {
line: 1,
column: 0
},
range: [
3,
24
],
loc: {
start: {
line: 1,
column: 3
},
end: {
line: 1,
column: 24
}
end: {
line: 1,
column: 27
}
}
],
},
closingElement: null,
children: [],
range: [

@@ -1095,3 +1117,2 @@ 0,

},
children: [],
range: [

@@ -1112,74 +1133,65 @@ 0,

},
range: [
0,
27
],
loc: {
start: {
line: 1,
column: 0
},
end: {
line: 1,
column: 27
}
}
},
'<a>{}</a>': {
type: 'ExpressionStatement',
expression: {
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSIdentifier',
name: 'a',
range: [1, 2],
'<a>{}</a>': {
type: 'ExpressionStatement',
expression: {
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSIdentifier',
name: 'a',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
selfClosing: false,
attributes: [],
range: [0, 3],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
selfClosing: false,
attributes: [],
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
closingElement: {
type: 'XJSClosingElement',
name: {
type: 'XJSIdentifier',
name: 'a',
range: [7, 8],
closingElement: {
type: 'XJSClosingElement',
name: {
type: 'XJSIdentifier',
name: 'a',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
},
range: [5, 9],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
start: { line: 1, column: 5 },
end: { line: 1, column: 9 }
}
},
range: [5, 9],
children: [{
type: 'XJSExpressionContainer',
expression: {
type: 'XJSEmptyExpression',
range: [4, 4],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 4 }
}
},
range: [3, 5],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 5 }
}
}],
range: [0, 9],
loc: {
start: { line: 1, column: 5 },
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
children: [{
type: 'XJSExpressionContainer',
expression: {
type: 'XJSEmptyExpression',
range: [4, 4],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 4 }
}
},
range: [3, 5],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 5 }
}
}],
range: [0, 9],

@@ -1191,65 +1203,65 @@ loc: {

},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
'<a>{/* this is a comment */}</a>': {
type: 'ExpressionStatement',
expression: {
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSIdentifier',
name: 'a',
range: [1, 2],
'<a>{/* this is a comment */}</a>': {
type: 'ExpressionStatement',
expression: {
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSIdentifier',
name: 'a',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
selfClosing: false,
attributes: [],
range: [0, 3],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
selfClosing: false,
attributes: [],
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
closingElement: {
type: 'XJSClosingElement',
name: {
type: 'XJSIdentifier',
name: 'a',
range: [30, 31],
closingElement: {
type: 'XJSClosingElement',
name: {
type: 'XJSIdentifier',
name: 'a',
range: [30, 31],
loc: {
start: { line: 1, column: 30 },
end: { line: 1, column: 31 }
}
},
range: [28, 32],
loc: {
start: { line: 1, column: 30 },
end: { line: 1, column: 31 }
start: { line: 1, column: 28 },
end: { line: 1, column: 32 }
}
},
range: [28, 32],
children: [{
type: 'XJSExpressionContainer',
expression: {
type: 'XJSEmptyExpression',
range: [4, 27],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 27 }
}
},
range: [3, 28],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 28 }
}
}],
range: [0, 32],
loc: {
start: { line: 1, column: 28 },
start: { line: 1, column: 0 },
end: { line: 1, column: 32 }
}
},
children: [{
type: 'XJSExpressionContainer',
expression: {
type: 'XJSEmptyExpression',
range: [4, 27],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 27 }
}
},
range: [3, 28],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 28 }
}
}],
range: [0, 32],

@@ -1261,59 +1273,59 @@ loc: {

},
range: [0, 32],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 32 }
}
},
'<div>@test content</div>': {
type: 'ExpressionStatement',
expression: {
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSIdentifier',
name: 'div',
range: [1, 4],
'<div>@test content</div>': {
type: 'ExpressionStatement',
expression: {
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSIdentifier',
name: 'div',
range: [1, 4],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 4 }
}
},
selfClosing: false,
attributes: [],
range: [0, 5],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 4 }
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
selfClosing: false,
attributes: [],
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
closingElement: {
type: 'XJSClosingElement',
name: {
type: 'XJSIdentifier',
name: 'div',
range: [20, 23],
closingElement: {
type: 'XJSClosingElement',
name: {
type: 'XJSIdentifier',
name: 'div',
range: [20, 23],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 23 }
}
},
range: [18, 24],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 23 }
start: { line: 1, column: 18 },
end: { line: 1, column: 24 }
}
},
range: [18, 24],
children: [{
type: 'Literal',
value: '@test content',
raw: '@test content',
range: [5, 18],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 18 }
}
}],
range: [0, 24],
loc: {
start: { line: 1, column: 18 },
start: { line: 1, column: 0 },
end: { line: 1, column: 24 }
}
},
children: [{
type: 'Literal',
value: '@test content',
raw: '@test content',
range: [5, 18],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 18 }
}
}],
range: [0, 24],

@@ -1325,21 +1337,32 @@ loc: {

},
range: [0, 24],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 24 }
}
},
'<div><br />7x invalid-js-identifier</div>': {
type: 'ExpressionStatement',
expression: {
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSIdentifier',
name: 'div',
'<div><br />7x invalid-js-identifier</div>': {
type: 'ExpressionStatement',
expression: {
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSIdentifier',
name: 'div',
range: [
1,
4
],
loc: {
start: {
line: 1,
column: 1
},
end: {
line: 1,
column: 4
}
}
},
selfClosing: false,
attributes: [],
range: [
1,
4
0,
5
],

@@ -1349,35 +1372,33 @@ loc: {

line: 1,
column: 1
column: 0
},
end: {
line: 1,
column: 4
column: 5
}
}
},
selfClosing: false,
attributes: [],
range: [
0,
5
],
loc: {
start: {
line: 1,
column: 0
closingElement: {
type: 'XJSClosingElement',
name: {
type: 'XJSIdentifier',
name: 'div',
range: [
37,
40
],
loc: {
start: {
line: 1,
column: 37
},
end: {
line: 1,
column: 40
}
}
},
end: {
line: 1,
column: 5
}
}
},
closingElement: {
type: 'XJSClosingElement',
name: {
type: 'XJSIdentifier',
name: 'div',
range: [
37,
40
35,
41
],

@@ -1387,35 +1408,37 @@ loc: {

line: 1,
column: 37
column: 35
},
end: {
line: 1,
column: 40
column: 41
}
}
},
range: [
35,
41
],
loc: {
start: {
line: 1,
column: 35
},
end: {
line: 1,
column: 41
}
}
},
children: [{
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSIdentifier',
name: 'br',
children: [{
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSIdentifier',
name: 'br',
range: [
6,
8
],
loc: {
start: {
line: 1,
column: 6
},
end: {
line: 1,
column: 8
}
}
},
selfClosing: true,
attributes: [],
range: [
6,
8
5,
11
],

@@ -1425,12 +1448,12 @@ loc: {

line: 1,
column: 6
column: 5
},
end: {
line: 1,
column: 8
column: 11
}
}
},
selfClosing: true,
attributes: [],
closingElement: null,
children: [],
range: [

@@ -1450,25 +1473,24 @@ 5,

}
},
children: [],
range: [
5,
11
],
loc: {
start: {
line: 1,
column: 5
},
end: {
line: 1,
column: 11
}, {
type: 'Literal',
value: '7x invalid-js-identifier',
raw: '7x invalid-js-identifier',
range: [
11,
35
],
loc: {
start: {
line: 1,
column: 11
},
end: {
line: 1,
column: 35
}
}
}
}, {
type: 'Literal',
value: '7x invalid-js-identifier',
raw: '7x invalid-js-identifier',
}],
range: [
11,
35
0,
41
],

@@ -1478,10 +1500,10 @@ loc: {

line: 1,
column: 11
column: 0
},
end: {
line: 1,
column: 35
column: 41
}
}
}],
},
range: [

@@ -1502,74 +1524,76 @@ 0,

},
range: [
0,
41
],
loc: {
start: {
line: 1,
column: 0
},
end: {
line: 1,
column: 41
}
}
},
'<LeftRight left=<a /> right=<b>monkeys /> gorillas</b> />': {
"type": "ExpressionStatement",
"expression": {
"type": "XJSElement",
"openingElement": {
"type": "XJSOpeningElement",
"name": {
"type": "XJSIdentifier",
"name": "LeftRight",
"range": [
1,
10
],
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 10
'<LeftRight left=<a /> right=<b>monkeys /> gorillas</b> />': {
"type": "ExpressionStatement",
"expression": {
"type": "XJSElement",
"openingElement": {
"type": "XJSOpeningElement",
"name": {
"type": "XJSIdentifier",
"name": "LeftRight",
"range": [
1,
10
],
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 10
}
}
}
},
"selfClosing": true,
"attributes": [
{
"type": "XJSAttribute",
"name": {
"type": "XJSIdentifier",
"name": "left",
"range": [
11,
15
],
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 15
},
"selfClosing": true,
"attributes": [
{
"type": "XJSAttribute",
"name": {
"type": "XJSIdentifier",
"name": "left",
"range": [
11,
15
],
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 15
}
}
}
},
"value": {
"type": "XJSElement",
"openingElement": {
"type": "XJSOpeningElement",
"name": {
"type": "XJSIdentifier",
"name": "a",
},
"value": {
"type": "XJSElement",
"openingElement": {
"type": "XJSOpeningElement",
"name": {
"type": "XJSIdentifier",
"name": "a",
"range": [
17,
18
],
"loc": {
"start": {
"line": 1,
"column": 17
},
"end": {
"line": 1,
"column": 18
}
}
},
"selfClosing": true,
"attributes": [],
"range": [
17,
18
16,
21
],

@@ -1579,12 +1603,12 @@ "loc": {

"line": 1,
"column": 17
"column": 16
},
"end": {
"line": 1,
"column": 18
"column": 21
}
}
},
"selfClosing": true,
"attributes": [],
closingElement: null,
"children": [],
"range": [

@@ -1605,5 +1629,4 @@ 16,

},
"children": [],
"range": [
16,
11,
21

@@ -1614,3 +1637,3 @@ ],

"line": 1,
"column": 16
"column": 11
},

@@ -1623,47 +1646,49 @@ "end": {

},
"range": [
11,
21
],
"loc": {
"start": {
"line": 1,
"column": 11
{
"type": "XJSAttribute",
"name": {
"type": "XJSIdentifier",
"name": "right",
"range": [
22,
27
],
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 27
}
}
},
"end": {
"line": 1,
"column": 21
}
}
},
{
"type": "XJSAttribute",
"name": {
"type": "XJSIdentifier",
"name": "right",
"range": [
22,
27
],
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 27
}
}
},
"value": {
"type": "XJSElement",
"openingElement": {
"type": "XJSOpeningElement",
"name": {
"type": "XJSIdentifier",
"name": "b",
"value": {
"type": "XJSElement",
"openingElement": {
"type": "XJSOpeningElement",
"name": {
"type": "XJSIdentifier",
"name": "b",
"range": [
29,
30
],
"loc": {
"start": {
"line": 1,
"column": 29
},
"end": {
"line": 1,
"column": 30
}
}
},
"selfClosing": false,
"attributes": [],
"range": [
29,
30
28,
31
],

@@ -1673,35 +1698,33 @@ "loc": {

"line": 1,
"column": 29
"column": 28
},
"end": {
"line": 1,
"column": 30
"column": 31
}
}
},
"selfClosing": false,
"attributes": [],
"range": [
28,
31
],
"loc": {
"start": {
"line": 1,
"column": 28
"closingElement": {
"type": "XJSClosingElement",
"name": {
"type": "XJSIdentifier",
"name": "b",
"range": [
52,
53
],
"loc": {
"start": {
"line": 1,
"column": 52
},
"end": {
"line": 1,
"column": 53
}
}
},
"end": {
"line": 1,
"column": 31
}
}
},
"closingElement": {
"type": "XJSClosingElement",
"name": {
"type": "XJSIdentifier",
"name": "b",
"range": [
52,
53
50,
54
],

@@ -1711,12 +1734,33 @@ "loc": {

"line": 1,
"column": 52
"column": 50
},
"end": {
"line": 1,
"column": 53
"column": 54
}
}
},
"children": [
{
"type": "Literal",
"value": "monkeys /> gorillas",
"raw": "monkeys /> gorillas",
"range": [
31,
50
],
"loc": {
"start": {
"line": 1,
"column": 31
},
"end": {
"line": 1,
"column": 50
}
}
}
],
"range": [
50,
28,
54

@@ -1727,3 +1771,3 @@ ],

"line": 1,
"column": 50
"column": 28
},

@@ -1736,25 +1780,4 @@ "end": {

},
"children": [
{
"type": "Literal",
"value": "monkeys /> gorillas",
"raw": "monkeys /> gorillas",
"range": [
31,
50
],
"loc": {
"start": {
"line": 1,
"column": 31
},
"end": {
"line": 1,
"column": 50
}
}
}
],
"range": [
28,
22,
54

@@ -1765,3 +1788,3 @@ ],

"line": 1,
"column": 28
"column": 22
},

@@ -1773,19 +1796,21 @@ "end": {

}
}
],
"range": [
0,
57
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"range": [
22,
54
],
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 54
}
"end": {
"line": 1,
"column": 57
}
}
],
},
closingElement: null,
"children": [],
"range": [

@@ -1806,3 +1831,2 @@ 0,

},
"children": [],
"range": [

@@ -1823,93 +1847,84 @@ 0,

},
"range": [
0,
57
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 57
}
}
},
'<a.b></a.b>': {
type: 'ExpressionStatement',
expression: {
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSMemberExpression',
object: {
type: 'XJSIdentifier',
name: 'a',
range: [1, 2],
'<a.b></a.b>': {
type: 'ExpressionStatement',
expression: {
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSMemberExpression',
object: {
type: 'XJSIdentifier',
name: 'a',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
property: {
type: 'XJSIdentifier',
name: 'b',
range: [3, 4],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
}
},
range: [1, 4],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
property: {
type: 'XJSIdentifier',
name: 'b',
range: [3, 4],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
}
},
range: [1, 4],
selfClosing: false,
attributes: [],
range: [0, 5],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 4 }
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
selfClosing: false,
attributes: [],
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
closingElement: {
type: 'XJSClosingElement',
name: {
type: 'XJSMemberExpression',
object: {
type: 'XJSIdentifier',
name: 'a',
range: [7, 8],
closingElement: {
type: 'XJSClosingElement',
name: {
type: 'XJSMemberExpression',
object: {
type: 'XJSIdentifier',
name: 'a',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
},
property: {
type: 'XJSIdentifier',
name: 'b',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
range: [7, 10],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
},
property: {
type: 'XJSIdentifier',
name: 'b',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
range: [7, 10],
range: [5, 11],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 10 }
start: { line: 1, column: 5 },
end: { line: 1, column: 11 }
}
},
range: [5, 11],
children: [],
range: [0, 11],
loc: {
start: { line: 1, column: 5 },
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
children: [],
range: [0, 11],

@@ -1921,26 +1936,35 @@ loc: {

},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
'<a.b.c></a.b.c>': {
type: 'ExpressionStatement',
expression: {
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSMemberExpression',
object: {
'<a.b.c></a.b.c>': {
type: 'ExpressionStatement',
expression: {
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSMemberExpression',
object: {
type: 'XJSIdentifier',
name: 'a',
range: [1, 2],
type: 'XJSMemberExpression',
object: {
type: 'XJSIdentifier',
name: 'a',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
property: {
type: 'XJSIdentifier',
name: 'b',
range: [3, 4],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
}
},
range: [1, 4],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
end: { line: 1, column: 4 }
}

@@ -1950,51 +1974,51 @@ },

type: 'XJSIdentifier',
name: 'b',
range: [3, 4],
name: 'c',
range: [5, 6],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
range: [1, 4],
range: [1, 6],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 4 }
}
},
property: {
type: 'XJSIdentifier',
name: 'c',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
range: [1, 6],
selfClosing: false,
attributes: [],
range: [0, 7],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 6 }
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
selfClosing: false,
attributes: [],
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
closingElement: {
type: 'XJSClosingElement',
name: {
type: 'XJSMemberExpression',
object: {
closingElement: {
type: 'XJSClosingElement',
name: {
type: 'XJSMemberExpression',
object: {
type: 'XJSIdentifier',
name: 'a',
range: [9, 10],
type: 'XJSMemberExpression',
object: {
type: 'XJSIdentifier',
name: 'a',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
property: {
type: 'XJSIdentifier',
name: 'b',
range: [11, 12],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 12 }
}
},
range: [9, 12],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
end: { line: 1, column: 12 }
}

@@ -2004,37 +2028,28 @@ },

type: 'XJSIdentifier',
name: 'b',
range: [11, 12],
name: 'c',
range: [13, 14],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 12 }
start: { line: 1, column: 13 },
end: { line: 1, column: 14 }
}
},
range: [9, 12],
range: [9, 14],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 12 }
}
},
property: {
type: 'XJSIdentifier',
name: 'c',
range: [13, 14],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 14 }
}
},
range: [9, 14],
range: [7, 15],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 14 }
start: { line: 1, column: 7 },
end: { line: 1, column: 15 }
}
},
range: [7, 15],
children: [],
range: [0, 15],
loc: {
start: { line: 1, column: 7 },
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
children: [],
range: [0, 15],

@@ -2046,64 +2061,586 @@ loc: {

},
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
// In order to more useful parse errors, we disallow following an
// XJSElement by a less-than symbol. In the rare case that the binary
// operator was intended, the tag can be wrapped in parentheses:
'(<div />) < x;': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '<',
left: {
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSIdentifier',
name: 'div',
range: [2, 5],
// In order to more useful parse errors, we disallow following an
// XJSElement by a less-than symbol. In the rare case that the binary
// operator was intended, the tag can be wrapped in parentheses:
'(<div />) < x;': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '<',
left: {
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSIdentifier',
name: 'div',
range: [2, 5],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 5 }
}
},
selfClosing: true,
attributes: [],
range: [1, 8],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 5 }
start: { line: 1, column: 1 },
end: { line: 1, column: 8 }
}
},
selfClosing: true,
attributes: [],
range: [1, 8],
closingElement: null,
children: [],
range: [0, 9],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 8 }
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
children: [],
range: [0, 9],
right: {
type: 'Identifier',
name: 'x',
range: [12, 13],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 13 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
right: {
type: 'Identifier',
name: 'x',
range: [12, 13],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 13 }
}
},
range: [0, 13],
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
end: { line: 1, column: 14 }
}
},
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
'<div {...props} />': {
"type": "ExpressionStatement",
"expression": {
"type": "XJSElement",
"openingElement": {
"type": "XJSOpeningElement",
"name": {
"type": "XJSIdentifier",
"name": "div",
"range": [
1,
4
],
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 4
}
}
},
"selfClosing": true,
"attributes": [
{
"type": "XJSSpreadAttribute",
"argument": {
"type": "Identifier",
"name": "props",
"range": [
9,
14
],
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 14
}
}
},
"range": [
5,
15
],
"loc": {
"start": {
"line": 1,
"column": 5
},
"end": {
"line": 1,
"column": 15
}
}
}
],
"range": [
0,
18
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 18
}
}
},
closingElement: null,
"children": [],
"range": [
0,
18
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 18
}
}
},
"range": [
0,
18
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 18
}
}
},
'<div {...props} post="attribute" />': {
"type": "ExpressionStatement",
"expression": {
"type": "XJSElement",
"openingElement": {
"type": "XJSOpeningElement",
"name": {
"type": "XJSIdentifier",
"name": "div",
"range": [
1,
4
],
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 4
}
}
},
"selfClosing": true,
"attributes": [
{
"type": "XJSSpreadAttribute",
"argument": {
"type": "Identifier",
"name": "props",
"range": [
9,
14
],
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 14
}
}
},
"range": [
5,
15
],
"loc": {
"start": {
"line": 1,
"column": 5
},
"end": {
"line": 1,
"column": 15
}
}
},
{
"type": "XJSAttribute",
"name": {
"type": "XJSIdentifier",
"name": "post",
"range": [
16,
20
],
"loc": {
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 1,
"column": 20
}
}
},
"value": {
"type": "Literal",
"value": "attribute",
"raw": "\"attribute\"",
"range": [
21,
32
],
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 32
}
}
},
"range": [
16,
32
],
"loc": {
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 1,
"column": 32
}
}
}
],
"range": [
0,
35
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 35
}
}
},
closingElement: null,
"children": [],
"range": [
0,
35
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 35
}
}
},
"range": [
0,
35
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 35
}
}
},
'<div pre="leading" pre2="attribute" {...props}></div>': {
"type": "ExpressionStatement",
"expression": {
"type": "XJSElement",
"openingElement": {
"type": "XJSOpeningElement",
"name": {
"type": "XJSIdentifier",
"name": "div",
"range": [
1,
4
],
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 4
}
}
},
"selfClosing": false,
"attributes": [
{
"type": "XJSAttribute",
"name": {
"type": "XJSIdentifier",
"name": "pre",
"range": [
5,
8
],
"loc": {
"start": {
"line": 1,
"column": 5
},
"end": {
"line": 1,
"column": 8
}
}
},
"value": {
"type": "Literal",
"value": "leading",
"raw": "\"leading\"",
"range": [
9,
18
],
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 18
}
}
},
"range": [
5,
18
],
"loc": {
"start": {
"line": 1,
"column": 5
},
"end": {
"line": 1,
"column": 18
}
}
},
{
"type": "XJSAttribute",
"name": {
"type": "XJSIdentifier",
"name": "pre2",
"range": [
19,
23
],
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 23
}
}
},
"value": {
"type": "Literal",
"value": "attribute",
"raw": "\"attribute\"",
"range": [
24,
35
],
"loc": {
"start": {
"line": 1,
"column": 24
},
"end": {
"line": 1,
"column": 35
}
}
},
"range": [
19,
35
],
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 35
}
}
},
{
"type": "XJSSpreadAttribute",
"argument": {
"type": "Identifier",
"name": "props",
"range": [
40,
45
],
"loc": {
"start": {
"line": 1,
"column": 40
},
"end": {
"line": 1,
"column": 45
}
}
},
"range": [
36,
46
],
"loc": {
"start": {
"line": 1,
"column": 36
},
"end": {
"line": 1,
"column": 46
}
}
}
],
"range": [
0,
47
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 47
}
}
},
"closingElement": {
"type": "XJSClosingElement",
"name": {
"type": "XJSIdentifier",
"name": "div",
"range": [
49,
52
],
"loc": {
"start": {
"line": 1,
"column": 49
},
"end": {
"line": 1,
"column": 52
}
}
},
"range": [
47,
53
],
"loc": {
"start": {
"line": 1,
"column": 47
},
"end": {
"line": 1,
"column": 53
}
}
},
"children": [],
"range": [
0,
53
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 53
}
}
},
"range": [
0,
53
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 53
}
}
}

@@ -2113,7 +2650,15 @@ }

for (var code in fbTestFixture) {
if (typeof exports !== "undefined") {
var test = require("./driver.js").test;
}
for (var code in fbTestFixture.XJS) {
test(code, {
type: 'Program',
body: [fbTestFixture[code]]
}, {locations: true, ranges: true});
body: [fbTestFixture.XJS[code]]
}, {
ecmaVersion: 6,
locations: true,
ranges: true
});
}

@@ -200,6 +200,6 @@ // AST walker module for Mozilla Parser API compatible trees

};
base.ReturnStatement = function(node, st, c) {
base.ReturnStatement = base.YieldExpression = function(node, st, c) {
if (node.argument) c(node.argument, st, "Expression");
};
base.ThrowStatement = function(node, st, c) {
base.ThrowStatement = base.SpreadElement = function(node, st, c) {
c(node.argument, st, "Expression");

@@ -223,3 +223,3 @@ };

};
base.ForInStatement = function(node, st, c) {
base.ForInStatement = base.ForOfStatement = function(node, st, c) {
c(node.left, st, "ForInit");

@@ -262,6 +262,6 @@ c(node.right, st, "Expression");

for (var i = 0; i < node.properties.length; ++i)
c(node.properties[i].value, st, "Expression");
c(node.properties[i], st);
};
base.FunctionExpression = base.FunctionDeclaration;
base.SequenceExpression = function(node, st, c) {
base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration;
base.SequenceExpression = base.TemplateLiteral = function(node, st, c) {
for (var i = 0; i < node.expressions.length; ++i)

@@ -291,4 +291,23 @@ c(node.expressions[i], st, "Expression");

};
base.Identifier = base.Literal = ignore;
base.Identifier = base.Literal = base.ExportDeclaration = base.ImportDeclaration = ignore;
base.TaggedTemplateExpression = function(node, st, c) {
c(node.tag, st, "Expression");
c(node.quasi, st);
};
base.ClassDeclaration = base.ClassExpression = function(node, st, c) {
if (node.superClass) c(node.superClass, st, "Expression");
for (var i = 0; i < node.body.body.length; i++)
c(node.body.body[i], st);
};
base.MethodDefinition = base.Property = function(node, st, c) {
if (node.computed) c(node.key, st, "Expression");
c(node.value, st, "Expression");
};
base.ComprehensionExpression = function(node, st, c) {
for (var i = 0; i < node.blocks.length; i++)
c(node.blocks[i].right, st, "Expression");
c(node.body, st, "Expression");
};
// A custom walker that keeps track of the scope chain and the

@@ -295,0 +314,0 @@ // variables defined in it.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc