We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example code:
if (foo) { bar } `template literal`;
// using espree 3.2.0 require('espree').parse('if (foo) { bar }\n`template literal`;', {ecmaVersion: 6, tokens: true}).tokens // output: [ Token { type: 'Keyword', value: 'if', start: 0, end: 2 }, Token { type: 'Punctuator', value: '(', start: 3, end: 4 }, Token { type: 'Identifier', value: 'foo', start: 4, end: 7 }, Token { type: 'Punctuator', value: ')', start: 7, end: 8 }, Token { type: 'Punctuator', value: '{', start: 9, end: 10 }, Token { type: 'Identifier', value: 'bar', start: 11, end: 14 }, { type: 'Template', value: '`template literal`' }, Token { type: 'Punctuator', value: ';', start: 35, end: 36 } ]
Note that the closing } for the if statement is missing in the list of tokens.
}
if
This does not appear to be a problem when using acorn directly:
acorn
// using acorn 4.0.3 var tokens = []; require('acorn').parse('if (foo) { bar }\n`template literal`;', {onToken: tokens}); tokens // output: [ // ... other tokens Token { type: TokenType { label: '}', keyword: undefined, beforeExpr: false, startsExpr: false, isLoop: false, isAssign: false, prefix: false, postfix: false, binop: null, updateContext: [Function] }, value: undefined, start: 15, end: 16 }, // ... other tokens ]
The text was updated successfully, but these errors were encountered:
Yeah, that's our bug. Acorn handles templates very different from Esprima, so we do some magic to get the correct output.
Sorry, something went wrong.
I'm working on this.
Fix: } token followed by template had been lost (fixes #293)
249a2bd
Fix: } token followed by template had been lost (fixes #293) (#294)
80abdce
No branches or pull requests
Example code:
Note that the closing
}
for theif
statement is missing in the list of tokens.This does not appear to be a problem when using
acorn
directly:The text was updated successfully, but these errors were encountered: