Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic on some input #28

Closed
gyscos opened this issue May 1, 2018 · 1 comment
Closed

Panic on some input #28

gyscos opened this issue May 1, 2018 · 1 comment
Labels
bug Something isn't working

Comments

@gyscos
Copy link

gyscos commented May 1, 2018

Given the file test.md:

Test

<div>
</div>

Running bat test.md panics:

% bat test.md            
───────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File test.md
───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ Test
   2   │ 
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error(-122, invalid pattern in look-behind)', libcore/result.rs:945:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:205
   3: std::panicking::default_hook
             at libstd/panicking.rs:221
   4: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:457
   5: std::panicking::begin_panic_fmt
             at libstd/panicking.rs:344
   6: rust_begin_unwind
             at libstd/panicking.rs:322
   7: core::panicking::panic_fmt
             at libcore/panicking.rs:71
   8: core::result::unwrap_failed
   9: syntect::parsing::syntax_definition::MatchPattern::compile_with_refs
  10: syntect::parsing::parser::ParseState::parse_line
  11: syntect::easy::HighlightLines::highlight
  12: bat::run
  13: bat::main
  14: std::rt::lang_start::{{closure}}
  15: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:304
  16: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:105
  17: std::rt::lang_start_internal
             at libstd/panicking.rs:283
             at libstd/panic.rs:361
             at libstd/rt.rs:58
  18: main
  19: __libc_start_main
  20: _start
@sharkdp sharkdp added the bug Something isn't working label May 1, 2018
@sharkdp sharkdp closed this as completed in 51b57cc May 1, 2018
@sharkdp
Copy link
Owner

sharkdp commented May 1, 2018

Thank you for reporting this.

Unfortunately, syntect (the library that we use for syntax highlighting) panics if it cannot parse a regular expression in one of the .sublime-syntax files, which makes it hard for us to deal with these errors in a nice way. This has already been addressed upstream: trishume/syntect#98

I have manually patched the Markdown syntax file to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants