Merge serial module into the graph module
This commit is contained in:
parent
bd5d46a5d4
commit
697dcc720d
17 changed files with 421 additions and 332 deletions
|
|
@ -67,6 +67,9 @@ pub fn parse(
|
|||
} else if lexeme.match_char('|') && lexeme.is_next_delimiter() {
|
||||
log!("End: Pipe followed by delimiter");
|
||||
if buffer.destination.is_empty() {
|
||||
if candidate.text().contains(':') {
|
||||
candidate.set_external(true);
|
||||
}
|
||||
push(Some(&candidate.text().clone()), tokens, state, graph);
|
||||
} else {
|
||||
push(Some(&buffer.destination.clone()), tokens, state, graph);
|
||||
|
|
|
|||
|
|
@ -48,7 +48,10 @@ pub fn parse(
|
|||
}
|
||||
if item_candidate.depth.is_some() {
|
||||
// if the current item candidate has a known depth, push it
|
||||
item_candidate.text = format(&item_candidate.text, graph);
|
||||
let (text, format_tokens) =
|
||||
format(&item_candidate.text, graph);
|
||||
item_candidate.text = text;
|
||||
state.format_tokens.extend_from_slice(&format_tokens);
|
||||
candidate.items.push(item_candidate.clone());
|
||||
}
|
||||
// push list candidate, reset state and exit context
|
||||
|
|
@ -60,7 +63,9 @@ pub fn parse(
|
|||
} else if lexeme.match_char('\n') {
|
||||
// found end of item, push it and reset state
|
||||
log!("Accepting item candidate {item_candidate}");
|
||||
item_candidate.text = format(&item_candidate.text, graph);
|
||||
let (text, format_tokens) = format(&item_candidate.text, graph);
|
||||
item_candidate.text = text;
|
||||
state.format_tokens.extend_from_slice(&format_tokens);
|
||||
candidate.items.push(item_candidate.clone());
|
||||
*item_candidate = Item::default();
|
||||
buffer.depth = 0;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use crate::syntax::content::parser::{
|
||||
Token,
|
||||
context::{Block, Context, Inline},
|
||||
token::{Anchor, Item, List},
|
||||
};
|
||||
|
|
@ -11,6 +12,7 @@ pub struct State {
|
|||
pub dom_ids: HashMap<String, Vec<String>>,
|
||||
pub switches: Switches,
|
||||
pub buffers: Buffers,
|
||||
pub format_tokens: Vec<Token>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
|
@ -91,6 +93,7 @@ impl Default for State {
|
|||
depth: 0,
|
||||
},
|
||||
},
|
||||
format_tokens: vec![],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue