trees_lang/
lib.rs

1#![allow(dead_code)]
2#![allow(unused_imports)]
3#![warn(missing_docs)]
4//! This crate provides official support for Trees code.
5//! Now only exports parsing features, but it planned to export other parts in the future.
6
7/// This module contains parser of the code.
8///
9/// Parse steps are:
10/// 1. `fn split_code()` - Split code into characters.
11/// 2. `fn find_blocks()` - Find blocks from the code.
12/// 3. `fn connect_blocks()` - Connect blocks by following edges.
13///
14/// # Example:
15/// ```
16/// use trees_lang::compile::{split_code, find_blocks, connect_blocks, CompileConfig};
17///
18/// let splited_code = split_code(
19///   &vec![
20///     "    ".to_owned(),
21///     "    ┌───────┐".to_owned(),
22///     "    │ abc   │    ".to_owned(),
23///     "    └───┬───┘   ".to_owned(),
24///     "        │   ".to_owned(),
25///     "    ┌───┴──┐".to_owned(),
26///     "    │ def  │    ".to_owned(),
27///     "    └──────┘   ".to_owned(),
28///   ],
29///   &CompileConfig::DEFAULT,
30/// );
31///  
32/// let mut blocks = find_blocks(&splited_code, &CompileConfig::DEFAULT);
33/// let head = connect_blocks(&splited_code, &mut blocks, &CompileConfig::DEFAULT).unwrap();
34///
35/// assert_eq!(head.proc_name, "abc".to_owned());
36/// ```
37pub mod compile;