1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#![feature(uniform_paths)]
#![allow(unused_parens)]
#![allow(dead_code)]
#![allow(unused_macros)]

use std::path::Path;
use std::path::PathBuf;

// use std::sync::Arc;

// use std::collections::HashMap;

pub type Line = String;
pub type LineVec = Vec <Line>;
pub type ElementVec = Vec <Element>;
pub type PropertyVec = Vec <Property>;

pub enum Element {
    N (Node),
    B (Block),
    T (Text),
    L (List),
}

pub struct Root {
    path: Option <PathBuf>,
    properties: PropertyVec,
    body: ElementVec,
}

pub struct Node {
    headline: Line,
    properties: PropertyVec,
    body: ElementVec,
}

pub struct List {
    list_type: ListType,
    content: Vec <(Text, Option <List>)>,
}

pub enum ListType {
    DashMark,
    PlusMark,
    Numbered,
}

pub struct Text {
   lines: LineVec,
}

pub struct Block {
   block_type: BlockType,
   properties: PropertyVec,
   lines: LineVec,
}

pub enum BlockType {
    CodeBlock,
}

pub enum Property {
    Tangle { path: PathBuf },
}