Skip to content

Commit 5ef739c

Browse files
author
arthurmelton
committed
last cmd
1 parent 1b95078 commit 5ef739c

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

src/run/functions.rs

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,44 @@ pub fn getstring(
353353
}
354354
}
355355
skips = leng;
356+
} else if vec[y] == "last" {
357+
imput_s.push_str(
358+
last(
359+
y,
360+
vec.to_vec(),
361+
memory_names.clone(),
362+
memory_values.clone(),
363+
memory_types.clone(),
364+
func_names.clone(),
365+
func_par.clone(),
366+
func_code.clone(),
367+
dev,
368+
)
369+
.as_str(),
370+
);
371+
let mut leng = 0;
372+
let mut n2 = 0;
373+
let mut skip1 = false;
374+
for elem in y + 1..vec.len() {
375+
if !skip1 {
376+
if vec[y + 1] != "(" {
377+
println!("You have to put a parentheses after a log");
378+
std::process::exit(1);
379+
}
380+
if contents[elem] == "(" {
381+
n2 += 1;
382+
} else if contents[elem] == ")" {
383+
n2 -= 1;
384+
}
385+
if n2 == 0 {
386+
skip1 = true;
387+
for _z in y + 1..elem + 1 {
388+
leng += 1;
389+
}
390+
}
391+
}
392+
}
393+
skips = leng;
356394
} else if vec[y] == "random" {
357395
imput_s.push_str(rand::thread_rng().gen::<f32>().to_string().as_str());
358396
} else if vec[y] == "request" {
@@ -1156,6 +1194,31 @@ pub fn first(
11561194
).join("zzGVgfHaNtPMe7H9RRyx3rWC9JyyZdMkc2v").split("zzGVgfHaNtPMe7H9RRyx3rWC9JyyZdMkc2v").collect::<Vec<&str>>().first().unwrap().to_string()
11571195
}
11581196

1197+
pub fn last(
1198+
x: usize,
1199+
contents: Vec<String>,
1200+
memory_names: Vec<String>,
1201+
memory_values: Vec<String>,
1202+
memory_types: Vec<String>,
1203+
func_names: Vec<String>,
1204+
func_par: Vec<String>,
1205+
func_code: Vec<String>,
1206+
dev: bool,
1207+
) -> String {
1208+
getstring(
1209+
x,
1210+
contents,
1211+
memory_names,
1212+
memory_values,
1213+
memory_types,
1214+
func_names,
1215+
func_par,
1216+
func_code,
1217+
dev,
1218+
0,
1219+
).join("zzGVgfHaNtPMe7H9RRyx3rWC9JyyZdMkc2v").split("zzGVgfHaNtPMe7H9RRyx3rWC9JyyZdMkc2v").collect::<Vec<&str>>().last().unwrap().to_string()
1220+
}
1221+
11591222
pub fn set_contents(
11601223
x: usize,
11611224
contents: Vec<String>,

0 commit comments

Comments
 (0)