Skip to content

Commit

Permalink
cambios inportantes y la secuencia: 'si condicional' agregada
Browse files Browse the repository at this point in the history
BUGS BUGS NOOOOOOOO
se arreglaron bugs pero las soluciones trajieron un bug en si condicional :(
  • Loading branch information
Troxsoft committed Dec 13, 2023
1 parent fd7dbff commit 1e7e5bb
Show file tree
Hide file tree
Showing 80 changed files with 322 additions and 5 deletions.
5 changes: 4 additions & 1 deletion arrays.qk
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
lista:juan
var: hola = 0
bucle 200:hola:juan.agregar(hola)
bucle 100:hola:juan.agregar( #*# @[hola] 13 )
std.escribir_lista(juan)
std.obt_indice(juanª0)
std.escribir(@[ret])
2 changes: 1 addition & 1 deletion bucles.qk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

-- bucles en quick !!!

var index = 0
var: index = 0
bucle 100 : index : std.escribir( #+# @[index] 1 )
-- array nombre
-- nombre.push()
2 changes: 1 addition & 1 deletion holamundo.qk
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
var mensaje = hola mundo
var: mensaje = hola mundo
std.escribir(@[mensaje])
33 changes: 32 additions & 1 deletion lenguaje/src/leng/qlenguaje.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,36 @@ impl Programa {
programa.set_variable2(var.clone(), format!("{}", i));
}
}
} else {
} else if linea.to_string().starts_with("si condicional"){//jdjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
let mut pt39h = linea[15..].to_string().clone();
let mut split_pt39h = pt39h.split("ª");
let mut varios:Vec<String> = Vec::new();
for mm25 in split_pt39h {
varios.push(mm25.trim().to_string());
}

if utils::verificar_len(varios.clone(), 3) == false{
return Err(ErrorLeng::new(format!("la longitud de parametros necesarios en la estructura: 'si condicional' SON invalidos :(. ['{}']",linea), programa.clone(), false));
}else{
if varios.clone()[0] != "verdadero" &&varios.clone()[0] != "falso"{
return Err(ErrorLeng::new(format!("Porfa verifica si el texto pasado tiene la siguiente sintaxis: 'verdadero' o 'falso' ['{}']",linea), programa.clone(), false));
}else{
if varios.clone()[0] == "verdadero"{
let err90 = Programa::init_program(programa.clone(), varios[1].clone());
if err90.is_err() {
return Err(err90.err().unwrap());
} //************************************************* */
programa = err90.ok().unwrap();
}else{
let err = Programa::init_program(programa.clone(), varios[2].clone());
if err.is_err() {
return Err(err.err().unwrap());
} //************************************************* */
programa = err.ok().unwrap();
}
}
}
}else {
//funciones
if linea.to_string().ends_with(")") == false {
return Err(ErrorLeng::new(
Expand Down Expand Up @@ -648,6 +677,8 @@ impl Programa {
programa = eje.ok().unwrap();
//println!("hola");
}
}else{
return Err(ErrorLeng::new(format!("la funcion no tiene prefijo o no existe: `{}`",linea.to_string()), programa.clone(), false));
}
}
}
Expand Down
100 changes: 100 additions & 0 deletions lenguaje/src/std_quick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,109 @@ pub fn get_std() -> Funciones {
//fun.add_funcion(escribir_color_fondo_std, "escribir_colorf".to_string());
fun.add_funcion(get_vector_indice, "obt_indice".to_string());
fun.add_funcion(escribir_std_vector, "escribir_lista".to_string());

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
}


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(
"
--------------------------------------------
Error ):
FALTAN PARAMETROS
-------------------------------------------
"
.to_string(),
programa.clone(),
false,
));
}
if utils::es_numero(params[0].clone())==false{
return Err(ErrorLeng::new("el supuesto numero '1' no es un numero :( PRUEBA ESTA SINTAXIS 'std.es_mayor( @[n1] ª @[n2] )' ".to_string(), programa.clone(), false));
}
if utils::es_numero(params[1].clone())==false{
return Err(ErrorLeng::new("el supuesto numero '2' no es un numero :( PRUEBA ESTA SINTAXIS 'std.es_mayor( @[n1] ª @[n2] )' ".to_string(), programa.clone(), false));
}
let mut pro = programa.clone();
if params[0].parse::<isize>().ok().unwrap() < params[1].parse::<isize>().ok().unwrap(){
pro.set_variable(pro.clone(),"ret".to_string(), "verdadero".to_string());
}else{
pro.set_variable(pro.clone(),"ret".to_string(), "falso".to_string());
}
return Ok(pro);
}












fn igual_txt_numero_std(params: Vec<String>, mut programa: Programa) -> Result<Programa, ErrorLeng> {
if utils::verificar_len(params.clone(), 2) == false {
return Err(ErrorLeng::new(
"
--------------------------------------------
Error ):
FALTAN PARAMETROS
-------------------------------------------
"
.to_string(),
programa.clone(),
false,
));
}

let mut pro = programa.clone();
if params[0] == params[1]{
pro.set_variable(pro.clone(),"ret".to_string(), "verdadero".to_string());
}else{
pro.set_variable(pro.clone(),"ret".to_string(), "falso".to_string());
}
return Ok(pro);
}
fn mayor_numero_std(params: Vec<String>, mut programa: Programa) -> Result<Programa, ErrorLeng> {
if utils::verificar_len(params.clone(), 2) == false {
return Err(ErrorLeng::new(
"
--------------------------------------------
Error ):
FALTAN PARAMETROS
-------------------------------------------
"
.to_string(),
programa.clone(),
false,
));
}
if utils::es_numero(params[0].clone())==false{
return Err(ErrorLeng::new("el supuesto numero '1' no es un numero :( PRUEBA ESTA SINTAXIS 'std.es_mayor( @[n1] ª @[n2] )' ".to_string(), programa.clone(), false));
}
if utils::es_numero(params[1].clone())==false{
return Err(ErrorLeng::new("el supuesto numero '2' no es un numero :( PRUEBA ESTA SINTAXIS 'std.es_mayor( @[n1] ª @[n2] )' ".to_string(), programa.clone(), false));
}
let mut pro = programa.clone();
if params[0].parse::<isize>().ok().unwrap() > params[1].parse::<isize>().ok().unwrap(){
pro.set_variable(pro.clone(),"ret".to_string(), "verdadero".to_string());
}else{
pro.set_variable(pro.clone(),"ret".to_string(), "falso".to_string());
}
return Ok(pro);
}

fn eliminar_std_vector(params: Vec<String>, mut programa: Programa) -> Result<Programa, ErrorLeng> {
if utils::verificar_len(params.clone(), 1) == false {
return Err(ErrorLeng::new(
Expand Down
2 changes: 1 addition & 1 deletion lenguaje/target/.rustc_info.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"rustc_fingerprint":8922270933721407765,"outputs":{"15729799797837862367":{"success":true,"status":"","code":0,"stdout":"___.exe\nlib___.rlib\n___.dll\n___.dll\n___.lib\n___.dll\nC:\\Users\\Usuario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\npacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"msvc\"\ntarget_family=\"windows\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"windows\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"pc\"\nwindows\n","stderr":""},"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.73.0 (cc66ad468 2023-10-03)\nbinary: rustc\ncommit-hash: cc66ad468955717ab92600c770da8c1601a4ff33\ncommit-date: 2023-10-03\nhost: x86_64-pc-windows-msvc\nrelease: 1.73.0\nLLVM version: 17.0.2\n","stderr":""}},"successes":{}}
{"rustc_fingerprint":11662978572852344380,"outputs":{"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.74.1 (a28077b28 2023-12-04)\nbinary: rustc\ncommit-hash: a28077b28a02b92985b3a3faecf92813155f1ea1\ncommit-date: 2023-12-04\nhost: x86_64-pc-windows-msvc\nrelease: 1.74.1\nLLVM version: 17.0.4\n","stderr":""},"12744816824612481171":{"success":true,"status":"","code":0,"stdout":"___.exe\nlib___.rlib\n___.dll\n___.dll\n___.lib\n___.dll\nC:\\Users\\troxz\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\npacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"msvc\"\ntarget_family=\"windows\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"windows\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"pc\"\nwindows\n","stderr":""},"15729799797837862367":{"success":true,"status":"","code":0,"stdout":"___.exe\nlib___.rlib\n___.dll\n___.dll\n___.lib\n___.dll\nC:\\Users\\troxz\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\npacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"msvc\"\ntarget_family=\"windows\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"windows\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"pc\"\nwindows\n","stderr":""}},"successes":{}}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file has an mtime of when this was started.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
01318eab2aea4102
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":8349863189884543492,"features":"[]","target":6004991775113783611,"profile":14473208297124147686,"path":1676164303036531941,"deps":[[796539694340413272,"windows_sys",false,14334876763368118043],[6685014296130524576,"lazy_static",false,3867718697442055411],[14196622868701567160,"is_terminal",false,1777444857632692052]],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\colored-8278a5e344389ae6\\dep-lib-colored"}}],"rustflags":[],"metadata":1356078279564610439,"config":2202906307356721367,"compile_kind":0}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file has an mtime of when this was started.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
54970a43aec0aa18
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":8349863189884543492,"features":"[]","target":8847024640214747843,"profile":14473208297124147686,"path":9588756247756155983,"deps":[[796539694340413272,"windows_sys",false,14334876763368118043]],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\is-terminal-eea146f6dfeb936a\\dep-lib-is-terminal"}}],"rustflags":[],"metadata":10282796769989993602,"config":2202906307356721367,"compile_kind":0}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file has an mtime of when this was started.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f3942bcca9e5ac35
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":8349863189884543492,"features":"[]","target":1623840821729021818,"profile":14473208297124147686,"path":8581583840785411271,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\lazy_static-5883212d9417946f\\dep-lib-lazy_static"}}],"rustflags":[],"metadata":111743654650316589,"config":2202906307356721367,"compile_kind":0}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file has an mtime of when this was started.
Loading

0 comments on commit 1e7e5bb

Please sign in to comment.