biome_js_parser 0.5.7

Biome's JavaScript parser
Documentation
JsModule {
    bom_token: missing (optional),
    interpreter_token: missing (optional),
    directives: JsDirectiveList [],
    items: JsModuleItemList [
        JsVariableStatement {
            declaration: JsVariableDeclaration {
                await_token: missing (optional),
                kind: LET_KW@0..4 "let" [] [Whitespace(" ")],
                declarators: JsVariableDeclaratorList [
                    JsVariableDeclarator {
                        id: JsIdentifierBinding {
                            name_token: IDENT@4..6 "a" [] [Whitespace(" ")],
                        },
                        variable_annotation: missing (optional),
                        initializer: JsInitializerClause {
                            eq_token: EQ@6..8 "=" [] [Whitespace(" ")],
                            expression: JsObjectExpression {
                                l_curly_token: L_CURLY@8..9 "{" [] [],
                                members: JsObjectMemberList [
                                    missing element,
                                    COMMA@9..11 "," [] [Whitespace(" ")],
                                    JsShorthandPropertyObjectMember {
                                        name: JsReferenceIdentifier {
                                            value_token: IDENT@11..14 "foo" [] [],
                                        },
                                    },
                                ],
                                r_curly_token: R_CURLY@14..15 "}" [] [],
                            },
                        },
                    },
                ],
            },
            semicolon_token: missing (optional),
        },
        JsVariableStatement {
            declaration: JsVariableDeclaration {
                await_token: missing (optional),
                kind: LET_KW@15..20 "let" [Newline("\n")] [Whitespace(" ")],
                declarators: JsVariableDeclaratorList [
                    JsVariableDeclarator {
                        id: JsIdentifierBinding {
                            name_token: IDENT@20..22 "b" [] [Whitespace(" ")],
                        },
                        variable_annotation: missing (optional),
                        initializer: JsInitializerClause {
                            eq_token: EQ@22..24 "=" [] [Whitespace(" ")],
                            expression: JsObjectExpression {
                                l_curly_token: L_CURLY@24..26 "{" [] [Whitespace(" ")],
                                members: JsObjectMemberList [
                                    JsShorthandPropertyObjectMember {
                                        name: JsReferenceIdentifier {
                                            value_token: IDENT@26..30 "foo" [] [Whitespace(" ")],
                                        },
                                    },
                                    missing separator,
                                    JsShorthandPropertyObjectMember {
                                        name: JsReferenceIdentifier {
                                            value_token: IDENT@30..34 "bar" [] [Whitespace(" ")],
                                        },
                                    },
                                ],
                                r_curly_token: R_CURLY@34..35 "}" [] [],
                            },
                        },
                    },
                ],
            },
            semicolon_token: missing (optional),
        },
        JsVariableStatement {
            declaration: JsVariableDeclaration {
                await_token: missing (optional),
                kind: LET_KW@35..40 "let" [Newline("\n")] [Whitespace(" ")],
                declarators: JsVariableDeclaratorList [
                    JsVariableDeclarator {
                        id: JsIdentifierBinding {
                            name_token: IDENT@40..42 "b" [] [Whitespace(" ")],
                        },
                        variable_annotation: missing (optional),
                        initializer: JsInitializerClause {
                            eq_token: EQ@42..44 "=" [] [Whitespace(" ")],
                            expression: JsObjectExpression {
                                l_curly_token: L_CURLY@44..46 "{" [] [Whitespace(" ")],
                                members: JsObjectMemberList [
                                    JsShorthandPropertyObjectMember {
                                        name: JsReferenceIdentifier {
                                            value_token: IDENT@46..49 "foo" [] [],
                                        },
                                    },
                                ],
                                r_curly_token: missing (required),
                            },
                        },
                    },
                ],
            },
            semicolon_token: missing (optional),
        },
    ],
    eof_token: EOF@49..50 "" [Newline("\n")] [],
}

0: JS_MODULE@0..50
  0: (empty)
  1: (empty)
  2: JS_DIRECTIVE_LIST@0..0
  3: JS_MODULE_ITEM_LIST@0..49
    0: JS_VARIABLE_STATEMENT@0..15
      0: JS_VARIABLE_DECLARATION@0..15
        0: (empty)
        1: LET_KW@0..4 "let" [] [Whitespace(" ")]
        2: JS_VARIABLE_DECLARATOR_LIST@4..15
          0: JS_VARIABLE_DECLARATOR@4..15
            0: JS_IDENTIFIER_BINDING@4..6
              0: IDENT@4..6 "a" [] [Whitespace(" ")]
            1: (empty)
            2: JS_INITIALIZER_CLAUSE@6..15
              0: EQ@6..8 "=" [] [Whitespace(" ")]
              1: JS_OBJECT_EXPRESSION@8..15
                0: L_CURLY@8..9 "{" [] []
                1: JS_OBJECT_MEMBER_LIST@9..14
                  0: (empty)
                  1: COMMA@9..11 "," [] [Whitespace(" ")]
                  2: JS_SHORTHAND_PROPERTY_OBJECT_MEMBER@11..14
                    0: JS_REFERENCE_IDENTIFIER@11..14
                      0: IDENT@11..14 "foo" [] []
                2: R_CURLY@14..15 "}" [] []
      1: (empty)
    1: JS_VARIABLE_STATEMENT@15..35
      0: JS_VARIABLE_DECLARATION@15..35
        0: (empty)
        1: LET_KW@15..20 "let" [Newline("\n")] [Whitespace(" ")]
        2: JS_VARIABLE_DECLARATOR_LIST@20..35
          0: JS_VARIABLE_DECLARATOR@20..35
            0: JS_IDENTIFIER_BINDING@20..22
              0: IDENT@20..22 "b" [] [Whitespace(" ")]
            1: (empty)
            2: JS_INITIALIZER_CLAUSE@22..35
              0: EQ@22..24 "=" [] [Whitespace(" ")]
              1: JS_OBJECT_EXPRESSION@24..35
                0: L_CURLY@24..26 "{" [] [Whitespace(" ")]
                1: JS_OBJECT_MEMBER_LIST@26..34
                  0: JS_SHORTHAND_PROPERTY_OBJECT_MEMBER@26..30
                    0: JS_REFERENCE_IDENTIFIER@26..30
                      0: IDENT@26..30 "foo" [] [Whitespace(" ")]
                  1: (empty)
                  2: JS_SHORTHAND_PROPERTY_OBJECT_MEMBER@30..34
                    0: JS_REFERENCE_IDENTIFIER@30..34
                      0: IDENT@30..34 "bar" [] [Whitespace(" ")]
                2: R_CURLY@34..35 "}" [] []
      1: (empty)
    2: JS_VARIABLE_STATEMENT@35..49
      0: JS_VARIABLE_DECLARATION@35..49
        0: (empty)
        1: LET_KW@35..40 "let" [Newline("\n")] [Whitespace(" ")]
        2: JS_VARIABLE_DECLARATOR_LIST@40..49
          0: JS_VARIABLE_DECLARATOR@40..49
            0: JS_IDENTIFIER_BINDING@40..42
              0: IDENT@40..42 "b" [] [Whitespace(" ")]
            1: (empty)
            2: JS_INITIALIZER_CLAUSE@42..49
              0: EQ@42..44 "=" [] [Whitespace(" ")]
              1: JS_OBJECT_EXPRESSION@44..49
                0: L_CURLY@44..46 "{" [] [Whitespace(" ")]
                1: JS_OBJECT_MEMBER_LIST@46..49
                  0: JS_SHORTHAND_PROPERTY_OBJECT_MEMBER@46..49
                    0: JS_REFERENCE_IDENTIFIER@46..49
                      0: IDENT@46..49 "foo" [] []
                2: (empty)
      1: (empty)
  4: EOF@49..50 "" [Newline("\n")] []
--
object_expr_err.js:2:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × expected `,` but instead found `bar`
  
    1 │ let a = {, foo}
  > 2 │ let b = { foo bar }
      │               ^^^
    3 │ let b = { foo
    4 │ 
  
  i Remove bar
  
--
object_expr_err.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × expected `}` but instead the file ends
  
    2 │ let b = { foo bar }
    3 │ let b = { foo
  > 4 │ 
      │ 
  
  i the file ends here
  
    2 │ let b = { foo bar }
    3 │ let b = { foo
  > 4 │ 
      │ 
  
--
let a = {, foo}
let b = { foo bar }
let b = { foo