diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-09-09 11:07:46 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-09-09 11:07:46 +0200 |
commit | ffef323d3c927f84e94cae21afeb541be7320f1c (patch) | |
tree | 14a8723655413cb3f3dd52b1024b41450b59aca2 /src/construct/partial_mdx_jsx.rs | |
parent | 0c45c04fbbea1cc8de15fdec07a68333f9948658 (diff) | |
download | markdown-rs-ffef323d3c927f84e94cae21afeb541be7320f1c.tar.gz markdown-rs-ffef323d3c927f84e94cae21afeb541be7320f1c.tar.bz2 markdown-rs-ffef323d3c927f84e94cae21afeb541be7320f1c.zip |
Add some missing docs
Diffstat (limited to 'src/construct/partial_mdx_jsx.rs')
-rw-r--r-- | src/construct/partial_mdx_jsx.rs | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/construct/partial_mdx_jsx.rs b/src/construct/partial_mdx_jsx.rs index b85fb50..583241a 100644 --- a/src/construct/partial_mdx_jsx.rs +++ b/src/construct/partial_mdx_jsx.rs @@ -1057,6 +1057,7 @@ pub fn es_whitespace_eol_after(tokenizer: &mut Tokenizer) -> State { } } +/// Check if a character can start a JSX identifier. fn id_start(code: Option<char>) -> bool { if let Some(char) = code { UnicodeID::is_id_start(char) || matches!(char, '$' | '_') @@ -1065,6 +1066,7 @@ fn id_start(code: Option<char>) -> bool { } } +/// Check if a character can continue a JSX identifier. fn id_cont(code: Option<char>) -> bool { if let Some(char) = code { UnicodeID::is_id_continue(char) || matches!(char, '-' | '\u{200c}' | '\u{200d}') @@ -1073,25 +1075,18 @@ fn id_cont(code: Option<char>) -> bool { } } -fn crash_lazy(tokenizer: &Tokenizer) -> State { - State::Error(format!( - "{}:{}: Unexpected lazy line in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc", - tokenizer.point.line, tokenizer.point.column - )) -} - +/// Crash because something happened `at`, with info on what was `expect`ed +/// instead. fn crash(tokenizer: &Tokenizer, at: &str, expect: &str) -> State { - let char = if tokenizer.current == None { - None - } else { - char_after_index(tokenizer.parse_state.bytes, tokenizer.point.index) - }; - State::Error(format!( "{}:{}: Unexpected {} {}, expected {}", tokenizer.point.line, tokenizer.point.column, - format_char_opt(char), + format_char_opt(if tokenizer.current == None { + None + } else { + char_after_index(tokenizer.parse_state.bytes, tokenizer.point.index) + }), at, expect )) |