pub fn build_map(data: Vec<Vec<&str>>) -> Node
Expand description

Build a map from a list of sequential codes.

§Example

use afrim_memory::{Cursor, Node, utils};
use std::rc::Rc;

let data = utils::load_data(r#"
..a     ä
..af    ɑ̈
..ai    ɛ̈
"#);
let text_buffer = utils::build_map(data);
let memory = Rc::new(text_buffer);

let mut cursor = Cursor::new(memory, 8);
"..af".chars().for_each(|c| { cursor.hit(c); });

assert_eq!(cursor.state(), (Some("ɑ̈".to_owned()), 4, 'f'));