biome_js_parser 0.5.7

Biome's JavaScript parser
Documentation
JsModule {
    bom_token: missing (optional),
    interpreter_token: missing (optional),
    directives: JsDirectiveList [],
    items: JsModuleItemList [
        JsThrowStatement {
            throw_token: THROW_KW@0..5 "throw" [] [],
            argument: missing (required),
            semicolon_token: missing (optional),
        },
        JsExpressionStatement {
            expression: JsNewExpression {
                new_token: NEW_KW@5..10 "new" [Newline("\n")] [Whitespace(" ")],
                callee: JsIdentifierExpression {
                    name: JsReferenceIdentifier {
                        value_token: IDENT@10..15 "Error" [] [],
                    },
                },
                type_arguments: missing (optional),
                arguments: JsCallArguments {
                    l_paren_token: L_PAREN@15..16 "(" [] [],
                    args: JsCallArgumentList [
                        JsStringLiteralExpression {
                            value_token: JS_STRING_LITERAL@16..26 "\"oh no :(\"" [] [],
                        },
                    ],
                    r_paren_token: R_PAREN@26..27 ")" [] [],
                },
            },
            semicolon_token: missing (optional),
        },
        JsThrowStatement {
            throw_token: THROW_KW@27..33 "throw" [Newline("\n")] [],
            argument: missing (required),
            semicolon_token: SEMICOLON@33..34 ";" [] [],
        },
    ],
    eof_token: EOF@34..35 "" [Newline("\n")] [],
}

0: JS_MODULE@0..35
  0: (empty)
  1: (empty)
  2: JS_DIRECTIVE_LIST@0..0
  3: JS_MODULE_ITEM_LIST@0..34
    0: JS_THROW_STATEMENT@0..5
      0: THROW_KW@0..5 "throw" [] []
      1: (empty)
      2: (empty)
    1: JS_EXPRESSION_STATEMENT@5..27
      0: JS_NEW_EXPRESSION@5..27
        0: NEW_KW@5..10 "new" [Newline("\n")] [Whitespace(" ")]
        1: JS_IDENTIFIER_EXPRESSION@10..15
          0: JS_REFERENCE_IDENTIFIER@10..15
            0: IDENT@10..15 "Error" [] []
        2: (empty)
        3: JS_CALL_ARGUMENTS@15..27
          0: L_PAREN@15..16 "(" [] []
          1: JS_CALL_ARGUMENT_LIST@16..26
            0: JS_STRING_LITERAL_EXPRESSION@16..26
              0: JS_STRING_LITERAL@16..26 "\"oh no :(\"" [] []
          2: R_PAREN@26..27 ")" [] []
      1: (empty)
    2: JS_THROW_STATEMENT@27..34
      0: THROW_KW@27..33 "throw" [Newline("\n")] []
      1: (empty)
      2: SEMICOLON@33..34 ";" [] []
  4: EOF@34..35 "" [Newline("\n")] []
--
throw_stmt_err.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × Linebreaks between a throw statement and the error to be thrown are not allowed
  
    1 │ throw
  > 2 │ new Error("oh no :(")
      │ ^^^
    3 │ throw;
    4 │ 
  
  i A linebreak is not allowed here
  
  i Help: did you mean to throw this?
  
    1 │ throw
  > 2 │ new Error("oh no :(")
      │ ^^^
    3 │ throw;
    4 │ 
  
--
throw_stmt_err.js:3:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × Expected an expression but instead found ';'.
  
    1 │ throw
    2 │ new Error("oh no :(")
  > 3 │ throw;
      │      ^
    4 │ 
  
  i Expected an expression here.
  
    1 │ throw
    2 │ new Error("oh no :(")
  > 3 │ throw;
      │      ^
    4 │ 
  
--
throw
new Error("oh no :(")
throw;