From 8aee85680a358c0c25202a919a5ec542e0fb1c98 Mon Sep 17 00:00:00 2001 From: afonya Date: Mon, 16 Jun 2025 18:28:17 +0200 Subject: [PATCH] added fast functions --- src/parser.rs | 9 +++++++++ test.asl | 15 ++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/parser.rs b/src/parser.rs index a745c60..b36849a 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -825,6 +825,15 @@ fn next_operation(pos: &mut usize, input: &Vec, op_ends: &Vec, par } *pos += 1; return ASTPart::Assigment(AstAssigment { variable: var.value.clone(), value: Box::new(ASTPart::Import(AstImport { path: path.value.clone(), pos: token.pos })), pos: token.pos }); + } else if token.value == "lőcsve" { + if next_token.typ == TokenType::IDENTIFIER { + *pos += 1; + let func = read_function(input, pos, true, ctx); + return ASTPart::Assigment(AstAssigment { variable: next_token.value.clone(), value: Box::new(func), pos: *pos - 1 }); + } else { + let func = read_function(input, pos, true, ctx); + return check_continue(pos, input, func, op_ends, parse_ends, ctx); + } } else { let err = create_error(&format!("Unexpected `{:?}({})`", token.typ, token.value), token.pos, ErrorType::SyntaxError, ErrorSubType::Unexpected); print_error(&err, &ctx); diff --git a/test.asl b/test.asl index 7c4dd83..e12008f 100644 --- a/test.asl +++ b/test.asl @@ -1,7 +1,8 @@ -gethelj a = {1,2,[szaft"test"szaft]=128} -a = tábla.hozzáad(a, 1) -ugass(a) -a = tábla.töröl(a, 0) -ugass(a) -ugass(tábla.kulcsok(a)) -ugass(a+1) \ No newline at end of file +lőcsve test(a) { + ugass(a) +} + +test(97) +lőcsve(a) { + ugass(a) +}(98) \ No newline at end of file