1.15
(пропущена 1.14 чек коммент)
This commit is contained in:
parent
5accf66180
commit
4a5ef76889
@ -8,6 +8,11 @@ fn find_labels(stack: &mut Stack) {
|
||||
let label = &stack.program[stack.program_counter as usize];
|
||||
stack.program_counter += 1;
|
||||
|
||||
/*
|
||||
* "Теперь трубой можно подменять значения в лейблах"
|
||||
? но как это реализовать?
|
||||
Да и тем более, не понятно работает ли это вообще в lbruntime
|
||||
*/
|
||||
if !label.name.starts_with('@') {
|
||||
continue;
|
||||
}
|
||||
@ -32,8 +37,15 @@ fn find_prefix_operators(instruction: &mut Instruction, memory: &mut StackVec) {
|
||||
match instruction.name.chars().nth(0) {
|
||||
Some('|') => {
|
||||
instruction.name = instruction.name.chars().skip(1).collect();
|
||||
|
||||
instruction.data = memory.pop();
|
||||
}
|
||||
Some('/') => {
|
||||
instruction.name = instruction.name.chars().skip(1).collect();
|
||||
|
||||
memory.push(instruction.data);
|
||||
instruction.data = 0;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
@ -46,6 +58,12 @@ pub fn execute(stack: &mut Stack, mut origin_stack: Option<&mut Stack>, mod_name
|
||||
|
||||
find_prefix_operators(&mut instruction, &mut stack.memory);
|
||||
|
||||
if instruction.name.chars().nth(0) == Some('#')
|
||||
|| instruction.name.chars().nth(0) == Some('$')
|
||||
{
|
||||
instruction.name = instruction.name.chars().skip(1).collect();
|
||||
}
|
||||
|
||||
if instruction.name.starts_with('@') {
|
||||
continue;
|
||||
}
|
||||
@ -120,22 +138,20 @@ pub fn execute(stack: &mut Stack, mut origin_stack: Option<&mut Stack>, mod_name
|
||||
"getc" => instructions::io::getc(&mut stack.memory),
|
||||
"scan" => instructions::io::scan(&mut stack.memory),
|
||||
"meow" => instructions::io::meow(&mut stack.memory),
|
||||
"#print" => instructions::io::print(instruction.arg.clone()),
|
||||
"$print" => instructions::io::print(instruction.arg.clone()),
|
||||
"#println" => instructions::io::println(instruction.arg.clone()),
|
||||
"$println" => instructions::io::println(instruction.arg.clone()),
|
||||
"print" => instructions::io::print(instruction.arg.clone()),
|
||||
"println" => instructions::io::println(instruction.arg.clone()),
|
||||
|
||||
// Modules
|
||||
"args" => {
|
||||
instructions::modules::args(&mut stack.memory, &mut origin_stack, instruction.data)
|
||||
}
|
||||
"#exec" => {
|
||||
"exec" => {
|
||||
let arg = instruction.arg.clone();
|
||||
instructions::modules::exec(stack, arg, mod_name.clone())
|
||||
}
|
||||
|
||||
// Self-modifying
|
||||
"#insert" => {
|
||||
"insert" => {
|
||||
let arg = instruction.arg.clone();
|
||||
let data = instruction.data.clone();
|
||||
instructions::self_modify::insert(&mut stack.program, arg, data)
|
||||
@ -145,8 +161,8 @@ pub fn execute(stack: &mut Stack, mut origin_stack: Option<&mut Stack>, mod_name
|
||||
"dump" => instructions::special::dump(&mut stack.memory),
|
||||
"size" => instructions::special::size(&mut stack.memory),
|
||||
"maxsize" => instructions::special::maxsize(&mut stack.memory),
|
||||
"#expr" => instructions::special::expr(&mut stack.memory, instruction.arg.clone()),
|
||||
"nop" => continue,
|
||||
"expr" => instructions::special::expr(&mut stack.memory, instruction.arg.clone()),
|
||||
"field" => continue,
|
||||
"quit" => break,
|
||||
"exit" => instructions::special::exit(instruction.data),
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user