biome_js_parser 0.5.7

Biome's JavaScript parser
Documentation
JsModule {
    bom_token: missing (optional),
    interpreter_token: missing (optional),
    directives: JsDirectiveList [],
    items: JsModuleItemList [
        JsFunctionDeclaration {
            async_token: missing (optional),
            function_token: FUNCTION_KW@0..8 "function" [] [],
            star_token: STAR@8..10 "*" [] [Whitespace(" ")],
            id: JsIdentifierBinding {
                name_token: IDENT@10..14 "test" [] [],
            },
            type_parameters: missing (optional),
            parameters: JsParameters {
                l_paren_token: L_PAREN@14..15 "(" [] [],
                items: JsParameterList [],
                r_paren_token: R_PAREN@15..17 ")" [] [Whitespace(" ")],
            },
            return_type_annotation: missing (optional),
            body: JsFunctionBody {
                l_curly_token: L_CURLY@17..18 "{" [] [],
                directives: JsDirectiveList [],
                statements: JsStatementList [
                    JsFunctionDeclaration {
                        async_token: missing (optional),
                        function_token: FUNCTION_KW@18..30 "function" [Newline("\n"), Whitespace("  ")] [Whitespace(" ")],
                        star_token: missing (optional),
                        id: JsBogusBinding {
                            items: [
                                IDENT@30..35 "yield" [] [],
                            ],
                        },
                        type_parameters: missing (optional),
                        parameters: JsParameters {
                            l_paren_token: L_PAREN@35..36 "(" [] [],
                            items: JsParameterList [
                                JsFormalParameter {
                                    decorators: JsDecoratorList [],
                                    binding: JsIdentifierBinding {
                                        name_token: IDENT@36..40 "test" [] [],
                                    },
                                    question_mark_token: missing (optional),
                                    type_annotation: missing (optional),
                                    initializer: missing (optional),
                                },
                            ],
                            r_paren_token: R_PAREN@40..42 ")" [] [Whitespace(" ")],
                        },
                        return_type_annotation: missing (optional),
                        body: JsFunctionBody {
                            l_curly_token: L_CURLY@42..43 "{" [] [],
                            directives: JsDirectiveList [],
                            statements: JsStatementList [],
                            r_curly_token: R_CURLY@43..44 "}" [] [],
                        },
                    },
                ],
                r_curly_token: R_CURLY@44..46 "}" [Newline("\n")] [],
            },
        },
    ],
    eof_token: EOF@46..47 "" [Newline("\n")] [],
}

0: JS_MODULE@0..47
  0: (empty)
  1: (empty)
  2: JS_DIRECTIVE_LIST@0..0
  3: JS_MODULE_ITEM_LIST@0..46
    0: JS_FUNCTION_DECLARATION@0..46
      0: (empty)
      1: FUNCTION_KW@0..8 "function" [] []
      2: STAR@8..10 "*" [] [Whitespace(" ")]
      3: JS_IDENTIFIER_BINDING@10..14
        0: IDENT@10..14 "test" [] []
      4: (empty)
      5: JS_PARAMETERS@14..17
        0: L_PAREN@14..15 "(" [] []
        1: JS_PARAMETER_LIST@15..15
        2: R_PAREN@15..17 ")" [] [Whitespace(" ")]
      6: (empty)
      7: JS_FUNCTION_BODY@17..46
        0: L_CURLY@17..18 "{" [] []
        1: JS_DIRECTIVE_LIST@18..18
        2: JS_STATEMENT_LIST@18..44
          0: JS_FUNCTION_DECLARATION@18..44
            0: (empty)
            1: FUNCTION_KW@18..30 "function" [Newline("\n"), Whitespace("  ")] [Whitespace(" ")]
            2: (empty)
            3: JS_BOGUS_BINDING@30..35
              0: IDENT@30..35 "yield" [] []
            4: (empty)
            5: JS_PARAMETERS@35..42
              0: L_PAREN@35..36 "(" [] []
              1: JS_PARAMETER_LIST@36..40
                0: JS_FORMAL_PARAMETER@36..40
                  0: JS_DECORATOR_LIST@36..36
                  1: JS_IDENTIFIER_BINDING@36..40
                    0: IDENT@36..40 "test" [] []
                  2: (empty)
                  3: (empty)
                  4: (empty)
              2: R_PAREN@40..42 ")" [] [Whitespace(" ")]
            6: (empty)
            7: JS_FUNCTION_BODY@42..44
              0: L_CURLY@42..43 "{" [] []
              1: JS_DIRECTIVE_LIST@43..43
              2: JS_STATEMENT_LIST@43..43
              3: R_CURLY@43..44 "}" [] []
        3: R_CURLY@44..46 "}" [Newline("\n")] []
  4: EOF@46..47 "" [Newline("\n")] []
--
function_id_err.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × Illegal use of `yield` as an identifier in generator function
  
    1 │ function* test() {
  > 2 │   function yield(test) {}
      │            ^^^^^
    3 │ }
    4 │ 
  
--
function* test() {
  function yield(test) {}
}