"use strict";
var acorn = require('acorn-jsx');
var ast = acorn.parse(`
<!--
`.trim(), {plugins: {jsx: true}});
console.log(JSON.stringify(ast, null, 4));
C:\Users\t-nagashima.AD\Documents\GitHub\acorn\node_modules\acorn-jsx\node_modules\acorn\dist\acorn.js:2223
throw err
^
SyntaxError: Unexpected token (1:1)
at Parser.pp$4.raise (C:\Users\t-nagashima.AD\Documents\GitHub\acorn\node_modules\acorn-jsx\node_modules\acorn\dist\acorn.js:2221:15)
at Parser.pp.unexpected (C:\Users\t-nagashima.AD\Documents\GitHub\acorn\node_modules\acorn-jsx\node_modules\acorn\dist\acorn.js:603:10)
at Parser.pp.jsx_parseIdentifier (C:\Users\t-nagashima.AD\Documents\GitHub\acorn\node_modules\acorn-jsx\inject.js:191:12)
at Parser.pp.jsx_parseNamespacedName (C:\Users\t-nagashima.AD\Documents\GitHub\acorn\node_modules\acorn-jsx\inject.js:200:21)
at Parser.pp.jsx_parseElementName (C:\Users\t-nagashima.AD\Documents\GitHub\acorn\node_modules\acorn-jsx\inject.js:213:21)
at Parser.pp.jsx_parseOpeningElementAt (C:\Users\t-nagashima.AD\Documents\GitHub\acorn\node_modules\acorn-jsx\inject.js:287:22)
at Parser.pp.jsx_parseElementAt (C:\Users\t-nagashima.AD\Documents\GitHub\acorn\node_modules\acorn-jsx\inject.js:310:31)
at Parser.pp.jsx_parseElement (C:\Users\t-nagashima.AD\Documents\GitHub\acorn\node_modules\acorn-jsx\inject.js:359:17)
at Parser.parseExprAtom (C:\Users\t-nagashima.AD\Documents\GitHub\acorn\node_modules\acorn-jsx\inject.js:381:23)
at Parser.pp$3.parseExprSubscripts (C:\Users\t-nagashima.AD\Documents\GitHub\acorn\node_modules\acorn-jsx\node_modules\acorn\dist\acorn.js:1715:21)
If there are HTML comments at places that JSXElements cannot exist, HTML comments don't trigger syntax errors.
"use strict";
var acorn = require('acorn-jsx');
var ast = acorn.parse(`
a<!--
`.trim(), {plugins: {jsx: true}});
console.log(JSON.stringify(ast, null, 4));
From https://github.com/ternjs/acorn/issues/454#issuecomment-242154528.
If I enable this plugin, HTML comments come to trigger syntax errors.
In the case that JSX plugin is disabled:
In the case that JSX plugin is enabled:
If there are HTML comments at places that JSXElements cannot exist, HTML comments don't trigger syntax errors.