biome_js_parser 0.5.7

Biome's JavaScript parser
Documentation
JsModule {
    bom_token: missing (optional),
    interpreter_token: missing (optional),
    directives: JsDirectiveList [],
    items: JsModuleItemList [
        JsWhileStatement {
            while_token: WHILE_KW@0..6 "while" [] [Whitespace(" ")],
            l_paren_token: L_PAREN@6..7 "(" [] [],
            test: JsBooleanLiteralExpression {
                value_token: TRUE_KW@7..11 "true" [] [],
            },
            r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")],
            body: JsBlockStatement {
                l_curly_token: L_CURLY@13..14 "{" [] [],
                statements: JsStatementList [
                    JsFunctionDeclaration {
                        async_token: missing (optional),
                        function_token: FUNCTION_KW@14..26 "function" [Newline("\n"), Whitespace("  ")] [Whitespace(" ")],
                        star_token: missing (optional),
                        id: JsIdentifierBinding {
                            name_token: IDENT@26..32 "helper" [] [],
                        },
                        type_parameters: missing (optional),
                        parameters: JsParameters {
                            l_paren_token: L_PAREN@32..33 "(" [] [],
                            items: JsParameterList [],
                            r_paren_token: R_PAREN@33..35 ")" [] [Whitespace(" ")],
                        },
                        return_type_annotation: missing (optional),
                        body: JsFunctionBody {
                            l_curly_token: L_CURLY@35..36 "{" [] [],
                            directives: JsDirectiveList [],
                            statements: JsStatementList [
                                JsBogusStatement {
                                    items: [
                                        BREAK_KW@36..46 "break" [Newline("\n"), Whitespace("    ")] [],
                                        SEMICOLON@46..47 ";" [] [],
                                    ],
                                },
                            ],
                            r_curly_token: R_CURLY@47..51 "}" [Newline("\n"), Whitespace("  ")] [],
                        },
                    },
                ],
                r_curly_token: R_CURLY@51..53 "}" [Newline("\n")] [],
            },
        },
    ],
    eof_token: EOF@53..54 "" [Newline("\n")] [],
}

0: JS_MODULE@0..54
  0: (empty)
  1: (empty)
  2: JS_DIRECTIVE_LIST@0..0
  3: JS_MODULE_ITEM_LIST@0..53
    0: JS_WHILE_STATEMENT@0..53
      0: WHILE_KW@0..6 "while" [] [Whitespace(" ")]
      1: L_PAREN@6..7 "(" [] []
      2: JS_BOOLEAN_LITERAL_EXPRESSION@7..11
        0: TRUE_KW@7..11 "true" [] []
      3: R_PAREN@11..13 ")" [] [Whitespace(" ")]
      4: JS_BLOCK_STATEMENT@13..53
        0: L_CURLY@13..14 "{" [] []
        1: JS_STATEMENT_LIST@14..51
          0: JS_FUNCTION_DECLARATION@14..51
            0: (empty)
            1: FUNCTION_KW@14..26 "function" [Newline("\n"), Whitespace("  ")] [Whitespace(" ")]
            2: (empty)
            3: JS_IDENTIFIER_BINDING@26..32
              0: IDENT@26..32 "helper" [] []
            4: (empty)
            5: JS_PARAMETERS@32..35
              0: L_PAREN@32..33 "(" [] []
              1: JS_PARAMETER_LIST@33..33
              2: R_PAREN@33..35 ")" [] [Whitespace(" ")]
            6: (empty)
            7: JS_FUNCTION_BODY@35..51
              0: L_CURLY@35..36 "{" [] []
              1: JS_DIRECTIVE_LIST@36..36
              2: JS_STATEMENT_LIST@36..47
                0: JS_BOGUS_STATEMENT@36..47
                  0: BREAK_KW@36..46 "break" [Newline("\n"), Whitespace("    ")] []
                  1: SEMICOLON@46..47 ";" [] []
              3: R_CURLY@47..51 "}" [Newline("\n"), Whitespace("  ")] []
        2: R_CURLY@51..53 "}" [Newline("\n")] []
  4: EOF@53..54 "" [Newline("\n")] []
--
break_in_nested_function.js:3:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × A `break` statement can only be used within an enclosing iteration or switch statement.
  
    1 │ while (true) {
    2 │   function helper() {
  > 3 │     break;
      │     ^^^^^
    4 │   }
    5 │ }
  
--
while (true) {
  function helper() {
    break;
  }
}