From cd5bb2d16c6b28332b0b6077b27b2b90a8051896 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 6 Oct 2022 15:57:55 +0200 Subject: Refactor to split parse from compile options --- src/parser.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/parser.rs') diff --git a/src/parser.rs b/src/parser.rs index c69eb38..b694bc5 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -4,7 +4,7 @@ use crate::event::{Event, Point}; use crate::state::{Name as StateName, State}; use crate::subtokenize::subtokenize; use crate::tokenizer::Tokenizer; -use crate::Options; +use crate::ParseOptions; use alloc::{string::String, vec, vec::Vec}; /// Info needed, in all content types, when parsing markdown. @@ -14,7 +14,7 @@ use alloc::{string::String, vec, vec::Vec}; #[derive(Debug)] pub struct ParseState<'a> { /// Configuration. - pub options: &'a Options, + pub options: &'a ParseOptions, /// List of chars. pub bytes: &'a [u8], /// Set of defined definition identifiers. @@ -26,7 +26,10 @@ pub struct ParseState<'a> { /// Turn a string of markdown into events. /// /// Passes the bytes back so the compiler can access the source. -pub fn parse<'a>(value: &'a str, options: &'a Options) -> Result<(Vec, &'a [u8]), String> { +pub fn parse<'a>( + value: &'a str, + options: &'a ParseOptions, +) -> Result<(Vec, &'a [u8]), String> { let mut parse_state = ParseState { options, bytes: value.as_bytes(), -- cgit