From 1c0dbdc11a8af6f95d6bbaa1cd05300f32d954bb Mon Sep 17 00:00:00 2001 From: Ika Date: Mon, 23 Nov 2020 22:37:50 +0800 Subject: [PATCH] fix: backslash line break should not be allowed in table --- corpus/issues.txt | 25 ++++++++++++++++++++++++- src/tree_sitter_markdown/inline_scan.cc | 2 +- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/corpus/issues.txt b/corpus/issues.txt index 6a193f1..e27ab5a 100644 --- a/corpus/issues.txt +++ b/corpus/issues.txt @@ -66,6 +66,30 @@ ss_*. (paragraph (text))) +================================================================================ +#14 - Assertion failed caused by unexpected backslash line break in table +================================================================================ +*�wj\�2[ +-| +&_&\ + + +-------------------------------------------------------------------------------- + +(document + (table + (table_header_row + (table_cell + (text))) + (table_delimiter_row + (table_column_alignment)) + (table_data_row + (table_cell + (text))) + (table_data_row + (table_cell + (text))))) + ================================================================================ #14 - SIGSEGV caused by incorrect end condition for the unpaired link title ================================================================================ @@ -76,4 +100,3 @@ ss_*. (document (paragraph (text))) - diff --git a/src/tree_sitter_markdown/inline_scan.cc b/src/tree_sitter_markdown/inline_scan.cc index fa864bf..0eac075 100644 --- a/src/tree_sitter_markdown/inline_scan.cc +++ b/src/tree_sitter_markdown/inline_scan.cc @@ -575,7 +575,7 @@ bool scn_inl_bsl(Lexer &lxr, InlineDelimiterList &inl_dlms, InlineContextStack & if (lxr.adv_if(is_asc_pun_chr)) { if (lxr.cur_chr() == '\\' && lxr.lka_chr() == '|' && in_tbl) lxr.adv(); inl_dlms.insert(nxt_inl_dlm_itr, InlineDelimiter(true, SYM_BSL_ESC, bgn_pos, lxr.cur_pos())); - } else if (VLD(SYM_BSL_LBK) && is_lbk_chr(lxr.lka_chr())) { + } else if (VLD(SYM_BSL_LBK) && !in_tbl && is_lbk_chr(lxr.lka_chr())) { LexedPosition bsl_end_pos = lxr.cur_pos(); BlockDelimiter *lit_brk = blk_dlms.lit_lbk(lxr.cur_row()); if (lit_brk == NULL_PTR) {