aboutsummaryrefslogtreecommitdiffstats
path: root/src/content/document.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-26 12:39:38 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-26 12:39:38 +0200
commit297784cb925b1196d89479fa24c898703ae598d6 (patch)
treefcf620504c74e723d4897f6b208f076f24e211f4 /src/content/document.rs
parentc998a346a342655e0a39136bc0490f810c0f95fb (diff)
downloadmarkdown-rs-297784cb925b1196d89479fa24c898703ae598d6.tar.gz
markdown-rs-297784cb925b1196d89479fa24c898703ae598d6.tar.bz2
markdown-rs-297784cb925b1196d89479fa24c898703ae598d6.zip
Refactor to simplify tokenizer
Diffstat (limited to 'src/content/document.rs')
-rw-r--r--src/content/document.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/content/document.rs b/src/content/document.rs
index 97d1299..0c3cef7 100644
--- a/src/content/document.rs
+++ b/src/content/document.rs
@@ -78,7 +78,8 @@ struct DocumentInfo {
pub fn document(parse_state: &mut ParseState, point: Point) -> Vec<Event> {
let mut tokenizer = Tokenizer::new(point, parse_state);
- tokenizer.push(0, parse_state.codes.len(), Box::new(start), true);
+ let state = tokenizer.push(0, parse_state.codes.len(), Box::new(start));
+ tokenizer.flush(state, true);
let mut index = 0;
let mut definitions = vec![];
@@ -400,8 +401,7 @@ fn exit_containers(
let mut current_events = tokenizer.events.split_off(info.index);
let next = info.next;
info.next = Box::new(flow); // This is weird but Rust needs a function there.
- let result = tokenizer.flush(next);
- assert!(matches!(result, State::Ok));
+ tokenizer.flush(State::Fn(next), false);
if *phase == Phase::Prefix {
info.index = tokenizer.events.len();