/**************************************************************************/ /* aethex_script.cpp */ /**************************************************************************/ /* This file is part of: */ /* AETHEX ENGINE */ /* https://aethex.foundation */ /**************************************************************************/ /* Copyright (c) 2026-present AeThex Labs. */ /* Based on AETHEX ENGINE, MIT License. */ /**************************************************************************/ #include "aethex_script.h" #include "aethex_tokenizer.h" #include "aethex_parser.h" #include "aethex_compiler.h" #include "core/config/project_settings.h" #include "core/io/file_access.h" #include "core/math/math_defs.h" // ============================================================================ // AeThexScriptLanguage // ============================================================================ AeThexScriptLanguage *AeThexScriptLanguage::singleton = nullptr; AeThexScriptLanguage::AeThexScriptLanguage() { ERR_FAIL_COND(singleton); singleton = this; } AeThexScriptLanguage::~AeThexScriptLanguage() { singleton = nullptr; } void AeThexScriptLanguage::init() { // Register built-in constants global_constants["PI"] = Math::PI; global_constants["TAU"] = Math::TAU; global_constants["INF"] = INFINITY; global_constants["NAN"] = NAN; print_line("AeThex Language initialized - Write once, deploy everywhere!"); } void AeThexScriptLanguage::finish() { global_constants.clear(); } Vector AeThexScriptLanguage::get_reserved_words() const { Vector words; // AeThex keywords static const char *keywords[] = { // Core constructs "reality", // Module/namespace declaration "journey", // Cross-platform function "portal", // Import/export "beacon", // Event/signal "artifact", // Class/object "essence", // Interface/trait "chronicle", // Enum // Control flow "when", // If/condition "otherwise", // Else "traverse", // For loop "while", // While loop "break", "continue", "return", "yield", // Data "let", // Variable "const", // Constant "mut", // Mutable "new", // Instance creation // Platform-specific "platform", // Platform declaration "sync", // Cross-platform sync "async", // Async operation "await", // Await async // Actions "notify", // Output/print "reveal", // Return/expose "summon", // Create/spawn "banish", // Destroy/remove // Compliance (built-in) "Passport", // Auth identity "Shield", // Data protection "Consent", // COPPA/GDPR // Literals "true", "false", "null", "self", "super", nullptr }; const char **w = keywords; while (*w) { words.push_back(*w); w++; } return words; } bool AeThexScriptLanguage::is_control_flow_keyword(const String &p_keyword) const { return p_keyword == "when" || p_keyword == "otherwise" || p_keyword == "traverse" || p_keyword == "while" || p_keyword == "break" || p_keyword == "continue" || p_keyword == "return" || p_keyword == "yield"; } Vector AeThexScriptLanguage::get_comment_delimiters() const { Vector delimiters; delimiters.push_back("# "); // Single line comment delimiters.push_back("/* */"); // Block comment return delimiters; } Vector AeThexScriptLanguage::get_doc_comment_delimiters() const { Vector delimiters; delimiters.push_back("## "); // Doc comment return delimiters; } Vector AeThexScriptLanguage::get_string_delimiters() const { Vector delimiters; delimiters.push_back("\" \""); delimiters.push_back("' '"); delimiters.push_back("` `"); // Template strings return delimiters; } Ref