@babel/parser: when I use parseExpression to parse code, I get some errors. #15045
-
I want to use parseExpression of @babel/parser to parse some Expression, but I got some SYNTAX_ERROR! The code looks like this: Am I using it wrong or is this function just not able to parse this kind of statement? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
Beta Was this translation helpful? Give feedback.
-
An expression is something that would be valid when wrapped in |
Beta Was this translation helpful? Give feedback.
An expression is something that would be valid when wrapped in
(
...)
. For example,1 + 2
is an expression because(1 + 2)
is valid code.const a = 1
isn't an expression, because(const a = 1)
is not valid JavaScript.