Skip to content

&option parse error and no ESC in strings make it impossible to set common termcap-options #43

@errael

Description

@errael

Looks like there's two bugs here.

  • &option_name syntax for reading/writing options not handled.
  • Can't put ESC char in strings. (any Control char?)

This is not urgent, the offending stuff can be put into a separate file and sourced.

All the following fail, don't know of another way to get this to work.
Probably put things like this in a vimscript and source it from vim9script.
(The incorrectly displayed character is an ESC, 0x1b)

  1. set t_vb=�[?5h$<100>�[?5l
  2. legacy set t_vb=�[?5h$<100>�[?5l
  3. &t_vb = "\<ESC>[?5h$<100>\<ESC>[?5l"

(1) and (2) fail the same way in the lexer; the escape char in a string.
(3) valid in both vimscript and vim9script fails in the parser.

set t_vb=�[?5h$<100>�[?5l
thread 'main' panicked at 'not yet implemented: Ok(67,9): '\u{1b}'', crates/vim9-lexer/src/lib.rs:824:39
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: vim9_lexer::Lexer::next_token
             at /src/tools/vim9jit/crates/vim9-lexer/src/lib.rs:824:39
   3: vim9_parser::Parser::fill_buffer
             at /src/tools/vim9jit/crates/vim9-parser/src/lib.rs:2421:29
   4: vim9_parser::Parser::pop
             at /src/tools/vim9jit/crates/vim9-parser/src/lib.rs:1971:13
   5: vim9_parser::SharedCommand::parse
             at /src/tools/vim9jit/crates/vim9-parser/src/lib.rs:428:23
   6: vim9_parser::Parser::parse_command
             at /src/tools/vim9jit/crates/vim9-parser/src/lib.rs:2528:21
   7: vim9_parser::Parser::parse_program
             at /src/tools/vim9jit/crates/vim9-parser/src/lib.rs:2589:33
   8: vim9_gen::generate
             at /src/tools/vim9jit/crates/vim9-gen/src/lib.rs:1759:19
   9: vim9jit::main
             at /src/tools/vim9jit/src/main.rs:107:31
  10: core::ops::function::FnOnce::call_once
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ops/function.rs:250:5
vim9script
&t_vb = "\<ESC>[?5h$<100>\<ESC>[?5l"
thread 'main' panicked at '
Failed to parse command.
Current Commands:Program {
    commands: [
        Vim9Script(
            Vim9ScriptCommand {
                noclear: false,
                eol: Token(EndOfLine, (0,10)->(0,10)),
            },
        ),
    ],
}.
Error: TODO: Parser kind: Parser {
    lexer: Lexer { position: 16, read_position: 17, ch: Some(' ') },
    token_buffer: RefCell {
        value: [
            Token(Ampersand, "&", (1,0)->(1,1)),
            Token(Identifier, "t_vb", (1,1)->(1,5)),
        ],
    },
    mode: RefCell {
        value: PostVim9Script,
    },
}', crates/vim9-parser/src/lib.rs:2591:29
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: vim9_parser::Parser::parse_program
             at /src/tools/vim9jit/crates/vim9-parser/src/lib.rs:2591:29
   3: vim9_gen::generate
             at /src/tools/vim9jit/crates/vim9-gen/src/lib.rs:1759:19
   4: vim9jit::main
             at /src/tools/vim9jit/src/main.rs:107:31
   5: 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