summaryrefslogtreecommitdiff
path: root/src/parser/mod.rs
blob: 4cf7e00af6658d82c897db39a402f14e0587c06d (plain)
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
pub enum CommandType {
    Label,
    Mov,
    Add,
}

pub enum CommandArgsType {
    Nil,
    Label,
    NotLabel,
}

pub struct CommandArgs {
    arg_type: CommandArgsType,
    args_vec: Vec<String>,
}

pub struct Row {
    pub command: CommandType,
    pub args: CommandArgs,
}

#[test]
fn check_row() {
    let r: Row = Row {
        command: CommandType::Mov,
        args: CommandArgs {
            arg_type: CommandArgsType::NotLabel,
            args_vec: vec!["r0".to_string(), "r1".to_string()],
        },
    };
    assert_eq!(r.args.args_vec[0], "r0");
}