stuck on how to put these functions into a list
This commit is contained in:
parent
55d8f450c6
commit
9e7620db82
@ -30,7 +30,7 @@ mod utils;
|
||||
/// Some(vec![x + y, x - y])
|
||||
/// }
|
||||
///
|
||||
/// run_instruction!(aux_iadd, int, state, int, int;);
|
||||
/// // rush_macro::run_instruction!(aux_iadd, int, _state, int, int;);
|
||||
/// ```
|
||||
/// would have the ; placed at the end of the instruction. Check rush's `tests/instruction_test.rs`
|
||||
/// file for an example using this code.
|
||||
|
2
rush_macro/src/utils/instructionlist.rs
Normal file
2
rush_macro/src/utils/instructionlist.rs
Normal file
@ -0,0 +1,2 @@
|
||||
//! This file implements the proc macro implementation for creating a list of instructions
|
||||
//! from a set of passed function declarations.
|
@ -1,6 +1,7 @@
|
||||
use syn::parse::{Parse, ParseStream};
|
||||
|
||||
pub mod instruction;
|
||||
pub mod instructionlist;
|
||||
|
||||
fn parse_zero_or_more<T: Parse>(input: ParseStream) -> Vec<T> {
|
||||
let mut result = Vec::new();
|
||||
|
@ -1,15 +1,10 @@
|
||||
use std::ops::Not;
|
||||
|
||||
use crate::push::state::{Gene, PushState};
|
||||
|
||||
use super::common::{code_from_exec, code_pop, int_pop};
|
||||
use crate::push::state::{Gene, PushState};
|
||||
use std::ops::Not;
|
||||
|
||||
/// Checks to see if a single gene is a block.
|
||||
fn _is_block(a: Gene) -> Option<bool> {
|
||||
Some(match a {
|
||||
Gene::Block(_) => true,
|
||||
_ => false,
|
||||
})
|
||||
Some(matches!(a, Gene::Block(_)))
|
||||
}
|
||||
|
||||
/// Checks to see if a single gene is not a block.
|
||||
|
@ -1,6 +1,5 @@
|
||||
use std::cmp::{max, min};
|
||||
|
||||
use crate::push::state::{Gene, PushState};
|
||||
use std::cmp::{max, min};
|
||||
|
||||
fn min_max_bounds(ndx: i128, length: usize) -> usize {
|
||||
max(0, min(ndx.unsigned_abs() as usize, length - 1))
|
||||
|
@ -1,6 +1,3 @@
|
||||
use crate::instructions::common::{int_dup, int_yank};
|
||||
use crate::push::state::PushState;
|
||||
|
||||
#[macro_use]
|
||||
pub mod macros {
|
||||
/// Runs a function and ensures the necessary variables are extracted from a state without error
|
||||
|
@ -43,3 +43,6 @@ fn run_extract_test() {
|
||||
run_instruction!(aux_char, char, test_state, vector_char;);
|
||||
assert_eq!(vec!['a', 'b'], test_state.char);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn instruction_list_test() {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user