|
|
|
@ -1,7 +1,8 @@ |
|
|
|
|
use sexp::Sexp; |
|
|
|
|
|
|
|
|
|
use crate::asm::data::literal::RoutineName; |
|
|
|
|
use crate::asm::error::CrsnError; |
|
|
|
|
use crate::asm::instr::{Instr, Flatten, Routine}; |
|
|
|
|
use crate::asm::instr::{Flatten, Instr, Routine}; |
|
|
|
|
use crate::asm::parse::arg_parser::TokenParser; |
|
|
|
|
use crate::asm::parse::parse_cond::parse_cond_branch; |
|
|
|
|
use crate::asm::parse::sexp_expect::{expect_list, expect_string_atom}; |
|
|
|
@ -9,7 +10,6 @@ use crate::asm::patches::SexpIsA; |
|
|
|
|
use crate::module::{CrsnExtension, ParseRes}; |
|
|
|
|
|
|
|
|
|
use super::parse_op::parse_op; |
|
|
|
|
use crate::asm::data::literal::RoutineName; |
|
|
|
|
|
|
|
|
|
pub fn parse_instructions(items: impl Iterator<Item=Sexp>, parsers: &[Box<dyn CrsnExtension>]) -> Result<Box<dyn Flatten>, CrsnError> { |
|
|
|
|
let mut parsed = vec![]; |
|
|
|
@ -68,10 +68,10 @@ pub fn parse_instructions(items: impl Iterator<Item=Sexp>, parsers: &[Box<dyn Cr |
|
|
|
|
Ok(Box::new(parsed)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fn parse_routine(mut toki : impl Iterator<Item=Sexp> + Clone, parsers: &[Box<dyn CrsnExtension>]) -> Result<Box<dyn Flatten>, CrsnError> { |
|
|
|
|
fn parse_routine(mut toki: impl Iterator<Item=Sexp> + Clone, parsers: &[Box<dyn CrsnExtension>]) -> Result<Box<dyn Flatten>, CrsnError> { |
|
|
|
|
let name = expect_string_atom(toki.next())?; |
|
|
|
|
|
|
|
|
|
let arg_tokens = TokenParser::new(toki.clone().take_while(|e| e.is_atom()).collect()); |
|
|
|
|
let _arg_tokens = TokenParser::new(toki.clone().take_while(|e| e.is_atom()).collect()); |
|
|
|
|
|
|
|
|
|
// TODO parse arg tokens
|
|
|
|
|
|
|
|
|
@ -79,6 +79,6 @@ fn parse_routine(mut toki : impl Iterator<Item=Sexp> + Clone, parsers: &[Box<dyn |
|
|
|
|
|
|
|
|
|
return Ok(Box::new(Routine { |
|
|
|
|
name: RoutineName(name), |
|
|
|
|
body |
|
|
|
|
})) |
|
|
|
|
body, |
|
|
|
|
})); |
|
|
|
|
} |
|
|
|
|