Skip to content

Problems with end of dict and comma #44

@errael

Description

@errael

(note list parsing has similar issues to dict)

Two errors

thread 'main' panicked at 'list_parser: comma: 
[expect_token] Got token: Token(EndOfLine, "\n", (2,8)->(2,8)), Expected: Comma
thread 'main' panicked at 'parse_dict_literal: [ensure_token] Got token: Token(EndOfLine, "\n", (1,19)->(1,19)), Expected: RightBrace', crates/vim9-parser/src/lib.rs:1719:18

details

A few that work

vim9script
g:splice_config = {
    a: 3
}
vim9script
g:splice_config = {
    a: 3,
    #
}

Removing the comma from the above, get the following

vim9script
g:splice_config = {
    a: 3
    #
}
thread 'main' panicked at 'list_parser: comma: 
[expect_token] Got token: Token(EndOfLine, "\n", (2,8)->(2,8)), Expected: Comma
Parser {
    lexer: Lexer { position: 47, read_position: 48, ch: Some('\n') },
    token_buffer: RefCell {
        value: [
            Token(EndOfLine, "\n", (2,8)->(2,8)),
            Token(Comment, "#", (3,4)->(3,5)),
            Token(RightBrace, "}", (4,0)->(4,1)),
        ],
    },
    mode: RefCell {
        value: PostVim9Script,
    },
}', crates/vim9-parser/src/lib.rs:2637:18
stack backtrace:
   0: rust_begin_unwind
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:593:5
   1: core::panicking::panic_fmt
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/panicking.rs:67:14
   2: core::result::unwrap_failed
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/result.rs:1651:5
   3: core::result::Result<T,E>::expect
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/result.rs:1033:23
   4: vim9_parser::Parser::list_parser
             at /src/tools/vim9jit/crates/vim9-parser/src/lib.rs:2636:13
   5: vim9_parser::Parser::parse_keyvalue_list
             at /src/tools/vim9jit/crates/vim9-parser/src/lib.rs:2679:9
   6: vim9_parser::prefix_expr::parse_dict_literal
             at /src/tools/vim9jit/crates/vim9-parser/src/lib.rs:1716:23
   7: core::ops::function::Fn::call
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ops/function.rs:79:5
   8: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/alloc/src/boxed.rs:2007:9
   9: vim9_parser::Parser::parse_expression
             at /src/tools/vim9jit/crates/vim9-parser/src/lib.rs:2238:29
  10: vim9_parser::StatementCommand::parse
             at /src/tools/vim9jit/crates/vim9-parser/src/lib.rs:634:37
  11: vim9_parser::Parser::parse_command
             at /src/tools/vim9jit/crates/vim9-parser/src/lib.rs:2561:21
  12: vim9_parser::Parser::parse_program
             at /src/tools/vim9jit/crates/vim9-parser/src/lib.rs:2589:33
  13: vim9_gen::generate
             at /src/tools/vim9jit/crates/vim9-gen/src/lib.rs:1759:19
  14: vim9jit::main
             at /src/tools/vim9jit/src/main.rs:107:31
  15: core::ops::function::FnOnce::call_once
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ops/function.rs:250:5
vim9script
g:splice_config = {
}
thread 'main' panicked at 'parse_dict_literal: [ensure_token] Got token: Token(EndOfLine, "\n", (1,19)->(1,19)), Expected: RightBrace', crates/vim9-parser/src/lib.rs:1719:18
stack backtrace:
   0: rust_begin_unwind
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:593:5
   1: core::panicking::panic_fmt
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/panicking.rs:67:14
   2: core::result::unwrap_failed
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/result.rs:1651:5
   3: core::result::Result<T,E>::expect
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/result.rs:1033:23
   4: vim9_parser::prefix_expr::parse_dict_literal
             at /src/tools/vim9jit/crates/vim9-parser/src/lib.rs:1717:20
   5: core::ops::function::Fn::call
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ops/function.rs:79:5
   6: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/alloc/src/boxed.rs:2007:9
   7: vim9_parser::Parser::parse_expression
             at /src/tools/vim9jit/crates/vim9-parser/src/lib.rs:2238:29
   8: vim9_parser::StatementCommand::parse
             at /src/tools/vim9jit/crates/vim9-parser/src/lib.rs:634:37
   9: vim9_parser::Parser::parse_command
             at /src/tools/vim9jit/crates/vim9-parser/src/lib.rs:2561:21
  10: vim9_parser::Parser::parse_program
             at /src/tools/vim9jit/crates/vim9-parser/src/lib.rs:2589:33
  11: vim9_gen::generate
             at /src/tools/vim9jit/crates/vim9-gen/src/lib.rs:1759:19
  12: vim9jit::main
             at /src/tools/vim9jit/src/main.rs:107:31
  13: core::ops::function::FnOnce::call_once
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ops/function.rs:250:5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions