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..9 "function" [] [Whitespace(" ")],
            star_token: missing (optional),
            id: JsIdentifierBinding {
                name_token: IDENT@9..12 "foo" [] [],
            },
            type_parameters: missing (optional),
            parameters: JsParameters {
                l_paren_token: L_PAREN@12..13 "(" [] [],
                items: JsParameterList [],
                r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")],
            },
            return_type_annotation: missing (optional),
            body: JsFunctionBody {
                l_curly_token: L_CURLY@15..17 "{" [] [Whitespace(" ")],
                directives: JsDirectiveList [],
                statements: JsStatementList [
                    JsBogusStatement {
                        items: [
                            CONTINUE_KW@17..25 "continue" [] [],
                            SEMICOLON@25..27 ";" [] [Whitespace(" ")],
                        ],
                    },
                ],
                r_curly_token: R_CURLY@27..28 "}" [] [],
            },
        },
        JsWhileStatement {
            while_token: WHILE_KW@28..35 "while" [Newline("\n")] [Whitespace(" ")],
            l_paren_token: L_PAREN@35..36 "(" [] [],
            test: JsBooleanLiteralExpression {
                value_token: TRUE_KW@36..40 "true" [] [],
            },
            r_paren_token: R_PAREN@40..42 ")" [] [Whitespace(" ")],
            body: JsBlockStatement {
                l_curly_token: L_CURLY@42..43 "{" [] [],
                statements: JsStatementList [
                    JsBogusStatement {
                        items: [
                            CONTINUE_KW@43..55 "continue" [Newline("\n"), Whitespace("  ")] [Whitespace(" ")],
                            JsLabel {
                                value_token: IDENT@55..58 "foo" [] [],
                            },
                            SEMICOLON@58..59 ";" [] [],
                        ],
                    },
                ],
                r_curly_token: R_CURLY@59..61 "}" [Newline("\n")] [],
            },
        },
        JsLabeledStatement {
            label: JsLabel {
                value_token: IDENT@61..65 "foo" [Newline("\n")] [],
            },
            colon_token: COLON@65..67 ":" [] [Whitespace(" ")],
            body: JsBlockStatement {
                l_curly_token: L_CURLY@67..68 "{" [] [],
                statements: JsStatementList [
                    JsBogusStatement {
                        items: [
                            CONTINUE_KW@68..80 "continue" [Newline("\n"), Whitespace("  ")] [Whitespace(" ")],
                            JsLabel {
                                value_token: IDENT@80..83 "foo" [] [],
                            },
                            SEMICOLON@83..84 ";" [] [],
                        ],
                    },
                ],
                r_curly_token: R_CURLY@84..86 "}" [Newline("\n")] [],
            },
        },
    ],
    eof_token: EOF@86..87 "" [Newline("\n")] [],
}

0: JS_MODULE@0..87
  0: (empty)
  1: (empty)
  2: JS_DIRECTIVE_LIST@0..0
  3: JS_MODULE_ITEM_LIST@0..86
    0: JS_FUNCTION_DECLARATION@0..28
      0: (empty)
      1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")]
      2: (empty)
      3: JS_IDENTIFIER_BINDING@9..12
        0: IDENT@9..12 "foo" [] []
      4: (empty)
      5: JS_PARAMETERS@12..15
        0: L_PAREN@12..13 "(" [] []
        1: JS_PARAMETER_LIST@13..13
        2: R_PAREN@13..15 ")" [] [Whitespace(" ")]
      6: (empty)
      7: JS_FUNCTION_BODY@15..28
        0: L_CURLY@15..17 "{" [] [Whitespace(" ")]
        1: JS_DIRECTIVE_LIST@17..17
        2: JS_STATEMENT_LIST@17..27
          0: JS_BOGUS_STATEMENT@17..27
            0: CONTINUE_KW@17..25 "continue" [] []
            1: SEMICOLON@25..27 ";" [] [Whitespace(" ")]
        3: R_CURLY@27..28 "}" [] []
    1: JS_WHILE_STATEMENT@28..61
      0: WHILE_KW@28..35 "while" [Newline("\n")] [Whitespace(" ")]
      1: L_PAREN@35..36 "(" [] []
      2: JS_BOOLEAN_LITERAL_EXPRESSION@36..40
        0: TRUE_KW@36..40 "true" [] []
      3: R_PAREN@40..42 ")" [] [Whitespace(" ")]
      4: JS_BLOCK_STATEMENT@42..61
        0: L_CURLY@42..43 "{" [] []
        1: JS_STATEMENT_LIST@43..59
          0: JS_BOGUS_STATEMENT@43..59
            0: CONTINUE_KW@43..55 "continue" [Newline("\n"), Whitespace("  ")] [Whitespace(" ")]
            1: JS_LABEL@55..58
              0: IDENT@55..58 "foo" [] []
            2: SEMICOLON@58..59 ";" [] []
        2: R_CURLY@59..61 "}" [Newline("\n")] []
    2: JS_LABELED_STATEMENT@61..86
      0: JS_LABEL@61..65
        0: IDENT@61..65 "foo" [Newline("\n")] []
      1: COLON@65..67 ":" [] [Whitespace(" ")]
      2: JS_BLOCK_STATEMENT@67..86
        0: L_CURLY@67..68 "{" [] []
        1: JS_STATEMENT_LIST@68..84
          0: JS_BOGUS_STATEMENT@68..84
            0: CONTINUE_KW@68..80 "continue" [Newline("\n"), Whitespace("  ")] [Whitespace(" ")]
            1: JS_LABEL@80..83
              0: IDENT@80..83 "foo" [] []
            2: SEMICOLON@83..84 ";" [] []
        2: R_CURLY@84..86 "}" [Newline("\n")] []
  4: EOF@86..87 "" [Newline("\n")] []
--
continue_stmt.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × A `continue` statement can only be used within an enclosing `for`, `while` or `do while` statement.
  
  > 1 │ function foo() { continue; }
      │                  ^^^^^^^^
    2 │ while (true) {
    3 │   continue foo;
  
--
continue_stmt.js:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × Use of undefined statement label `foo`
  
    1 │ function foo() { continue; }
    2 │ while (true) {
  > 3 │   continue foo;
      │            ^^^
    4 │ }
    5 │ foo: {
  
  i This label is used, but it is never defined
  
--
continue_stmt.js:6:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × A `continue` statement can only jump to a label of an enclosing `for`, `while` or `do while` statement.
  
    4 │ }
    5 │ foo: {
  > 6 │   continue foo;
      │            ^^^
    7 │ }
    8 │ 
  
  i This label
  
    4 │ }
    5 │ foo: {
  > 6 │   continue foo;
      │            ^^^
    7 │ }
    8 │ 
  
  i points to non-iteration statement
  
    3 │   continue foo;
    4 │ }
  > 5 │ foo: {
      │ ^^^
    6 │   continue foo;
    7 │ }
  
--
function foo() { continue; }
while (true) {
  continue foo;
}
foo: {
  continue foo;
}