Skip to content

Commit

Permalink
ejecuta
Browse files Browse the repository at this point in the history
  • Loading branch information
Troxsoft committed Dec 13, 2023
1 parent 1e7e5bb commit 20ef03b
Show file tree
Hide file tree
Showing 15 changed files with 58 additions and 14 deletions.
2 changes: 2 additions & 0 deletions ejecuta.qk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var: index = 0
bucle 200 : index : std.ejecuta_s(./bucles.qk)
38 changes: 38 additions & 0 deletions lenguaje/src/std_quick.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::fs;

use crate::{
funciones::fstructure::Funciones,
leng::{error_leng::ErrorLeng, qlenguaje::Programa},
Expand All @@ -22,10 +24,46 @@ pub fn get_std() -> Funciones {
fun.add_funcion(mayor_numero_std, "es_mayor".to_string());
fun.add_funcion(menor_numero_std, "es_menor".to_string());
fun.add_funcion(igual_txt_numero_std, "es_igual".to_string());
fun.add_funcion(ejecuta_std_vector, "ejecuta".to_string());
fun.add_funcion(ejecuta_seguro_std_vector, "ejecuta_seguro".to_string());
fun.add_funcion(ejecuta_seguro_std_vector, "ejecuta_s".to_string());
fun
}


fn ejecuta_std_vector(params: Vec<String>, mut programa: Programa) -> Result<Programa, ErrorLeng> {
if utils::verificar_len(params.clone(), 1) == false {
return Err(ErrorLeng::new(
"no se recibio la cantidad correcta de parametros".to_string(),
programa.clone(),
false,
));
}
let gk = Programa::init_program(programa.clone(), fs::read_to_string(params[0].clone()).ok().unwrap());
return gk;
}


fn ejecuta_seguro_std_vector(params: Vec<String>, mut programa: Programa) -> Result<Programa, ErrorLeng> {
if utils::verificar_len(params.clone(), 1) == false {
return Err(ErrorLeng::new(
"no se recibio la cantidad correcta de parametros".to_string(),
programa.clone(),
false,
));
}
let mut kolo = Programa::new();
kolo.add_funcion(get_std());
let gk = Programa::init_program(kolo, fs::read_to_string(params[0].clone()).ok().unwrap());
if gk.is_err(){
return Err(gk.err().unwrap());
}

return Ok(programa);
}



fn menor_numero_std(params: Vec<String>, mut programa: Programa) -> Result<Programa, ErrorLeng> {
if utils::verificar_len(params.clone(), 2) == false {
return Err(ErrorLeng::new(
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Binary file modified lenguaje/target/debug/deps/liblenguaje-8d9694daad057ed9.rmeta
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 20ef03b

Please sign in to comment.