From c91e935c62b8e254b9daadf37b915c983518bff4 Mon Sep 17 00:00:00 2001
From: Ferenc Szontágh <szf@fsociety.hu>
Date: Fri, 18 Apr 2025 16:25:35 +0000
Subject: [PATCH] add dynamic module load, more escape seq

---
 src/Lexer/Operators.hpp |   33 +++++++++++++++++++++------------
 1 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/src/Lexer/Operators.hpp b/src/Lexer/Operators.hpp
index 6725b99..794ef86 100644
--- a/src/Lexer/Operators.hpp
+++ b/src/Lexer/Operators.hpp
@@ -57,18 +57,27 @@
 
 [[nodiscard]] inline bool pushOperand(const Tokens::Token & token, const Symbols::Variables::Type & expected_var_type,
                                       std::vector<Parser::ParsedExpressionPtr> & output_queue) {
-    if (token.type == Tokens::Type::NUMBER || token.type == Tokens::Type::STRING_LITERAL ||
-        token.type == Tokens::Type::KEYWORD) {
-        // Parse literal: use expected type if provided, otherwise auto-detect
-        if (expected_var_type == Symbols::Variables::Type::NULL_TYPE) {
-            output_queue.push_back(
-                Parser::ParsedExpression::makeLiteral(
-                    Symbols::Value::fromString(token.value, /*autoDetectType*/ true)));
-        } else {
-            output_queue.push_back(
-                Parser::ParsedExpression::makeLiteral(
-                    Symbols::Value::fromString(token.value, expected_var_type)));
-        }
+    // Literal operands: number, string, or keyword literals (e.g., true/false/null)
+    if (token.type == Tokens::Type::NUMBER) {
+        // Numeric literal: auto-detect integer/double/float
+        output_queue.push_back(
+            Parser::ParsedExpression::makeLiteral(
+                Symbols::Value::fromString(token.value, /*autoDetectType*/ true)));
+        return true;
+    }
+    if (token.type == Tokens::Type::STRING_LITERAL) {
+        // String literal: use literal value
+        output_queue.push_back(
+            Parser::ParsedExpression::makeLiteral(
+                Symbols::Value(token.value)));
+        return true;
+    }
+    if (token.type == Tokens::Type::KEYWORD) {
+        // Keyword literal: e.g., true, false, null
+        // Auto-detect boolean or null as needed
+        output_queue.push_back(
+            Parser::ParsedExpression::makeLiteral(
+                Symbols::Value::fromString(token.value, /*autoDetectType*/ true)));
         return true;
     }
     if (token.type == Tokens::Type::VARIABLE_IDENTIFIER) {

--
Gitblit v1.9.3