summaryrefslogtreecommitdiff
path: root/src/parser
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser')
-rw-r--r--src/parser/mod.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/parser/mod.rs b/src/parser/mod.rs
new file mode 100644
index 0000000..4cf7e00
--- /dev/null
+++ b/src/parser/mod.rs
@@ -0,0 +1,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");
+}