From 7721f210c16e19b1c2af90f69130386b89bb5104 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Wed, 29 Jun 2022 10:26:39 +0200 Subject: Add support for sharing identifiers, references before definitions --- src/construct/label_end.rs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'src/construct') diff --git a/src/construct/label_end.rs b/src/construct/label_end.rs index 581e5e9..f43a740 100644 --- a/src/construct/label_end.rs +++ b/src/construct/label_end.rs @@ -413,13 +413,8 @@ pub fn start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { /// [a]: z /// ``` fn after(tokenizer: &mut Tokenizer, code: Code, info: Info) -> StateFnResult { - // let label_start = tokenizer - // .label_start_stack - // .get_mut(info.label_start_index) - // .unwrap(); - // To do: figure out if defined or not. - let defined = false; - println!("to do: is `{:?}` defined?", info); + let defined = tokenizer.parse_state.definitions.contains(&info.media.id); + match code { // Resource (`[asd](fgh)`)? Code::Char('(') => tokenizer.attempt(resource, move |is_ok| { @@ -487,10 +482,6 @@ fn reference_not_full(tokenizer: &mut Tokenizer, code: Code, info: Info) -> Stat /// [a]: z /// ``` fn ok(tokenizer: &mut Tokenizer, code: Code, mut info: Info) -> StateFnResult { - println!( - "ok res, ref full, ref, collapsed, or ref shortcut: {:?}", - info.media - ); // Remove this one and everything after it. let mut left: Vec = tokenizer .label_start_stack @@ -725,8 +716,8 @@ fn full_reference_after(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult }, false, )); - println!("to do: is `{:?}` defined?", id); - let defined = false; + let defined = tokenizer.parse_state.definitions.contains(&id); + // To do: set `id` on the media somehow? if defined { (State::Ok, Some(vec![code])) -- cgit