Skip to content

Commit

Permalink
fix: no "assertion failed" caused by unexpected block delimiter behin…
Browse files Browse the repository at this point in the history
…d the literal line break in unfinished inline stack
  • Loading branch information
ikatyang committed Jan 17, 2021
1 parent e4b3077 commit 62364f8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
27 changes: 27 additions & 0 deletions corpus/issues.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
================================================================================
#14 - Assertion failed caused by unexpected block delimiter behind the literal line break in unfinished inline stack
================================================================================
*$$
-:
<<<*$$
-:
<<<+-+-

--------------------------------------------------------------------------------

(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)))
(table_data_row
(table_cell
(text)))))
5 changes: 3 additions & 2 deletions src/tree_sitter_markdown/inline_scan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,10 @@ Symbol scn_inl(Lexer &lxr, InlineDelimiterList &inl_dlms, InlineContextStack &in
LexedIndex lbk_bgn_idx = lxr.cur_idx();
if (scn_eol(lxr, blk_dlms, blk_ctx_stk)) {
end_idx = lbk_bgn_idx;
} else {
assert(blk_dlms.back().sym() == SYM_LIT_LBK);
} else if (blk_dlms.back().sym() == SYM_LIT_LBK) {
lxr.jmp_pos(blk_dlms.back().end_pos());
} else {
is_invalid = true;
}
} else if (lit_brk->sym() != SYM_LIT_LBK) {
end_idx = lxr.cur_idx();
Expand Down

0 comments on commit 62364f8

Please sign in to comment.