pull/21/head
Ondřej Hruška 4 years ago
parent 4be5b4e05b
commit 822e7912aa
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 504
      Cargo.lock
  2. 4
      crsn/src/asm/parse/mod.rs
  3. 2
      crsn/src/asm/parse/parse_cond.rs
  4. 12
      crsn/src/asm/parse/parse_instr.rs
  5. 10
      crsn/src/module/mod.rs

504
Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -1,9 +1,9 @@
use std::sync::atomic::{AtomicU32, AtomicU64};
use std::sync::atomic::AtomicU32;
pub use parse_instr::parse_instructions;
use crate::asm::error::CrsnError;
use crate::asm::instr::{Flatten, Op, Routine};
use crate::asm::instr::Op;
use crate::asm::parse::sexp_expect::expect_list;
use crate::module::CrsnExtension;

@ -1,7 +1,7 @@
use sexp::Sexp;
use crate::asm::error::CrsnError;
use crate::asm::instr::{Cond, cond, Instr, Flatten};
use crate::asm::instr::{Cond, cond, Flatten};
use crate::asm::parse::parse_instr::parse_instructions;
use crate::asm::parse::sexp_expect::{expect_list, expect_string_atom};
use crate::asm::patches::TryRemove;

@ -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,
}));
}

@ -7,7 +7,7 @@ pub use eval_res::EvalRes;
use crate::asm::data::literal::Value;
use crate::asm::data::Mask;
use crate::asm::error::CrsnError;
use crate::asm::instr::{Op, Flatten};
use crate::asm::instr::{Flatten, Op};
use crate::asm::parse::arg_parser::TokenParser;
use crate::runtime::fault::Fault;
use crate::runtime::run_thread::state::RunState;
@ -47,14 +47,14 @@ pub trait CrsnExtension: Debug + Send + Sync + 'static {
/// Parse a generic S-expression (non-op)
fn parse_syntax(&self, keyword: &str, tokens: TokenParser, parsers: &[Box<dyn CrsnExtension>])
-> Result<ParseRes<Box<dyn Flatten>>, CrsnError>
-> Result<ParseRes<Box<dyn Flatten>>, CrsnError>
{
Ok(ParseRes::Unknown(tokens))
}
/// Drop an object referenced by a handle
fn drop_obj(&self, ti: &ThreadInfo, state: &mut RunState, handle: Value)
-> Result<Option<()>, Fault>
-> Result<Option<()>, Fault>
{
// Default impl - we do not support dropping this object
Ok(None)
@ -62,7 +62,7 @@ pub trait CrsnExtension: Debug + Send + Sync + 'static {
/// Run-time method called to read an object (using the object handle syntax)
fn read_obj(&self, ti: &ThreadInfo, state: &mut RunState, handle: Value, _mask: Mask)
-> Result<Option<Value>, Fault>
-> Result<Option<Value>, Fault>
{
// Default impl - we do not support reading this object
Ok(None)
@ -70,7 +70,7 @@ pub trait CrsnExtension: Debug + Send + Sync + 'static {
/// Run-time method called to write an object (using the object handle syntax)
fn write_obj(&self, ti: &ThreadInfo, state: &mut RunState, handle: Value, mask: Mask)
-> Result<Option<()>, Fault>
-> Result<Option<()>, Fault>
{
// Default impl - we do not support writing this object
Ok(None)

Loading…
Cancel
Save