biome_js_parser 0.5.7

Biome's JavaScript parser
Documentation
JsModule {
    bom_token: missing (optional),
    interpreter_token: missing (optional),
    directives: JsDirectiveList [],
    items: JsModuleItemList [
        JsExpressionStatement {
            expression: JsBogusExpression {
                items: [
                    JsBogus {
                        items: [
                            IDENT@0..5 "yield" [] [],
                        ],
                    },
                ],
            },
            semicolon_token: SEMICOLON@5..6 ";" [] [],
        },
        JsExpressionStatement {
            expression: JsAwaitExpression {
                await_token: AWAIT_KW@6..12 "await" [Newline("\n")] [],
                argument: missing (required),
            },
            semicolon_token: SEMICOLON@12..13 ";" [] [],
        },
        JsFunctionDeclaration {
            async_token: ASYNC_KW@13..20 "async" [Newline("\n")] [Whitespace(" ")],
            function_token: FUNCTION_KW@20..29 "function" [] [Whitespace(" ")],
            star_token: missing (optional),
            id: JsIdentifierBinding {
                name_token: IDENT@29..33 "test" [] [],
            },
            type_parameters: missing (optional),
            parameters: JsParameters {
                l_paren_token: L_PAREN@33..34 "(" [] [],
                items: JsParameterList [
                    JsFormalParameter {
                        decorators: JsDecoratorList [],
                        binding: JsBogusBinding {
                            items: [
                                IDENT@34..39 "await" [] [],
                            ],
                        },
                        question_mark_token: missing (optional),
                        type_annotation: missing (optional),
                        initializer: missing (optional),
                    },
                ],
                r_paren_token: R_PAREN@39..41 ")" [] [Whitespace(" ")],
            },
            return_type_annotation: missing (optional),
            body: JsFunctionBody {
                l_curly_token: L_CURLY@41..42 "{" [] [],
                directives: JsDirectiveList [],
                statements: JsStatementList [],
                r_curly_token: R_CURLY@42..43 "}" [] [],
            },
        },
        JsFunctionDeclaration {
            async_token: missing (optional),
            function_token: FUNCTION_KW@43..52 "function" [Newline("\n")] [],
            star_token: STAR@52..54 "*" [] [Whitespace(" ")],
            id: JsIdentifierBinding {
                name_token: IDENT@54..58 "test" [] [],
            },
            type_parameters: missing (optional),
            parameters: JsParameters {
                l_paren_token: L_PAREN@58..59 "(" [] [],
                items: JsParameterList [
                    JsFormalParameter {
                        decorators: JsDecoratorList [],
                        binding: JsBogusBinding {
                            items: [
                                IDENT@59..64 "yield" [] [],
                            ],
                        },
                        question_mark_token: missing (optional),
                        type_annotation: missing (optional),
                        initializer: missing (optional),
                    },
                ],
                r_paren_token: R_PAREN@64..66 ")" [] [Whitespace(" ")],
            },
            return_type_annotation: missing (optional),
            body: JsFunctionBody {
                l_curly_token: L_CURLY@66..67 "{" [] [],
                directives: JsDirectiveList [],
                statements: JsStatementList [],
                r_curly_token: R_CURLY@67..68 "}" [] [],
            },
        },
        JsBogusStatement {
            items: [
                ENUM_KW@68..73 "enum" [Newline("\n")] [],
                TsEnumMemberList [],
            ],
        },
        JsEmptyStatement {
            semicolon_token: SEMICOLON@73..74 ";" [] [],
        },
        JsExpressionStatement {
            expression: JsBogusExpression {
                items: [
                    JsBogus {
                        items: [
                            IDENT@74..85 "implements" [Newline("\n")] [],
                        ],
                    },
                ],
            },
            semicolon_token: SEMICOLON@85..86 ";" [] [],
        },
        JsExpressionStatement {
            expression: JsBogusExpression {
                items: [
                    JsBogus {
                        items: [
                            IDENT@86..96 "interface" [Newline("\n")] [],
                        ],
                    },
                ],
            },
            semicolon_token: SEMICOLON@96..97 ";" [] [],
        },
    ],
    eof_token: EOF@97..98 "" [Newline("\n")] [],
}

0: JS_MODULE@0..98
  0: (empty)
  1: (empty)
  2: JS_DIRECTIVE_LIST@0..0
  3: JS_MODULE_ITEM_LIST@0..97
    0: JS_EXPRESSION_STATEMENT@0..6
      0: JS_BOGUS_EXPRESSION@0..5
        0: JS_BOGUS@0..5
          0: IDENT@0..5 "yield" [] []
      1: SEMICOLON@5..6 ";" [] []
    1: JS_EXPRESSION_STATEMENT@6..13
      0: JS_AWAIT_EXPRESSION@6..12
        0: AWAIT_KW@6..12 "await" [Newline("\n")] []
        1: (empty)
      1: SEMICOLON@12..13 ";" [] []
    2: JS_FUNCTION_DECLARATION@13..43
      0: ASYNC_KW@13..20 "async" [Newline("\n")] [Whitespace(" ")]
      1: FUNCTION_KW@20..29 "function" [] [Whitespace(" ")]
      2: (empty)
      3: JS_IDENTIFIER_BINDING@29..33
        0: IDENT@29..33 "test" [] []
      4: (empty)
      5: JS_PARAMETERS@33..41
        0: L_PAREN@33..34 "(" [] []
        1: JS_PARAMETER_LIST@34..39
          0: JS_FORMAL_PARAMETER@34..39
            0: JS_DECORATOR_LIST@34..34
            1: JS_BOGUS_BINDING@34..39
              0: IDENT@34..39 "await" [] []
            2: (empty)
            3: (empty)
            4: (empty)
        2: R_PAREN@39..41 ")" [] [Whitespace(" ")]
      6: (empty)
      7: JS_FUNCTION_BODY@41..43
        0: L_CURLY@41..42 "{" [] []
        1: JS_DIRECTIVE_LIST@42..42
        2: JS_STATEMENT_LIST@42..42
        3: R_CURLY@42..43 "}" [] []
    3: JS_FUNCTION_DECLARATION@43..68
      0: (empty)
      1: FUNCTION_KW@43..52 "function" [Newline("\n")] []
      2: STAR@52..54 "*" [] [Whitespace(" ")]
      3: JS_IDENTIFIER_BINDING@54..58
        0: IDENT@54..58 "test" [] []
      4: (empty)
      5: JS_PARAMETERS@58..66
        0: L_PAREN@58..59 "(" [] []
        1: JS_PARAMETER_LIST@59..64
          0: JS_FORMAL_PARAMETER@59..64
            0: JS_DECORATOR_LIST@59..59
            1: JS_BOGUS_BINDING@59..64
              0: IDENT@59..64 "yield" [] []
            2: (empty)
            3: (empty)
            4: (empty)
        2: R_PAREN@64..66 ")" [] [Whitespace(" ")]
      6: (empty)
      7: JS_FUNCTION_BODY@66..68
        0: L_CURLY@66..67 "{" [] []
        1: JS_DIRECTIVE_LIST@67..67
        2: JS_STATEMENT_LIST@67..67
        3: R_CURLY@67..68 "}" [] []
    4: JS_BOGUS_STATEMENT@68..73
      0: ENUM_KW@68..73 "enum" [Newline("\n")] []
      1: TS_ENUM_MEMBER_LIST@73..73
    5: JS_EMPTY_STATEMENT@73..74
      0: SEMICOLON@73..74 ";" [] []
    6: JS_EXPRESSION_STATEMENT@74..86
      0: JS_BOGUS_EXPRESSION@74..85
        0: JS_BOGUS@74..85
          0: IDENT@74..85 "implements" [Newline("\n")] []
      1: SEMICOLON@85..86 ";" [] []
    7: JS_EXPRESSION_STATEMENT@86..97
      0: JS_BOGUS_EXPRESSION@86..96
        0: JS_BOGUS@86..96
          0: IDENT@86..96 "interface" [Newline("\n")] []
      1: SEMICOLON@96..97 ";" [] []
  4: EOF@97..98 "" [Newline("\n")] []
--
identifier_err.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × Illegal use of reserved keyword `yield` as an identifier in strict mode
  
  > 1 │ yield;
      │ ^^^^^
    2 │ await;
    3 │ async function test(await) {}
  
--
identifier_err.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × Expected an unary expression but instead found ';'.
  
    1 │ yield;
  > 2 │ await;
      │      ^
    3 │ async function test(await) {}
    4 │ function* test(yield) {}
  
  i Expected an unary expression here.
  
    1 │ yield;
  > 2 │ await;
      │      ^
    3 │ async function test(await) {}
    4 │ function* test(yield) {}
  
--
identifier_err.js:3:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × Illegal use of `await` as an identifier in an async context
  
    1 │ yield;
    2 │ await;
  > 3 │ async function test(await) {}
      │                     ^^^^^
    4 │ function* test(yield) {}
    5 │ enum;
  
--
identifier_err.js:4:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × Illegal use of `yield` as an identifier in generator function
  
    2 │ await;
    3 │ async function test(await) {}
  > 4 │ function* test(yield) {}
      │                ^^^^^
    5 │ enum;
    6 │ implements;
  
--
identifier_err.js:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × 'enum's are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.
  
    3 │ async function test(await) {}
    4 │ function* test(yield) {}
  > 5 │ enum;
      │ ^^^^
    6 │ implements;
    7 │ interface;
  
  i TypeScript only syntax
  
--
identifier_err.js:6:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × Illegal use of reserved keyword `implements` as an identifier in strict mode
  
    4 │ function* test(yield) {}
    5 │ enum;
  > 6 │ implements;
      │ ^^^^^^^^^^
    7 │ interface;
    8 │ 
  
--
identifier_err.js:7:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × Illegal use of reserved keyword `interface` as an identifier in strict mode
  
    5 │ enum;
    6 │ implements;
  > 7 │ interface;
      │ ^^^^^^^^^
    8 │ 
  
--
yield;
await;
async function test(await) {}
function* test(yield) {}
enum;
implements;
interface;