peek_literal


Description:

public int peek_literal (string chunk, int chunk_pos, bool is_end_of_chunks, string is_literal, out int flush_chars)

Peek for closing backtick delimiter when inside a code span (is_literal != ""). Handles both single-backtick and double-backtick spans: is_literal length 1 = LITERAL span, length 2 = CODE span. Only closes on an exact run of the opener length; longer runs are treated as content (e.g. two or three backticks inside a one-backtick span). When in a single-backtick span and or ` is seen (with no more chars or next not `), sets flush_chars to 2 or 3 so the caller can flush that many characters as content.

Parameters:

flush_chars

set to 2 or 3 when /` should be flushed as content; 0 otherwise

Returns:

0 no match (treat as content), -1 need more data, N match length in bytes