![]() |
ArkScript
A small, lisp-inspired, functional scripting language
|
#include <Repl.hpp>
Public Member Functions | |
| Repl (const std::vector< std::filesystem::path > &lib_env) | |
| Construct a new Repl object. | |
| int | run () |
| Start the REPL. | |
Private Member Functions | |
| void | cuiSetup () |
| Configure replxx. | |
| void | registerBuiltins () |
| std::optional< std::string > | getLine (bool continuation) |
| Get a line via replxx and handle commands. | |
| std::optional< std::string > | getCodeBlock () |
| Prompt the user to enter a complete code block and handle the prompt modifications until the code block is complete. | |
Private Attributes | |
| replxx::Replxx | m_repl |
| unsigned | m_line_count |
| std::string | m_code |
| std::string | m_temp_additional_code |
| bool | m_running |
| std::size_t | m_old_ip |
| std::vector< std::filesystem::path > | m_lib_env |
| State | m_state |
| VM | m_vm |
| bool | m_has_init_vm |
| std::vector< std::string > | m_keywords |
| std::vector< std::pair< std::string, replxx::Replxx::Color > > | m_words_colors |
|
explicit |
|
private |
Configure replxx.
Definition at line 85 of file Repl.cpp.
References Ark::internal::colors, Ark::internal::hookColor(), Ark::internal::hookCompletion(), Ark::internal::hookHint(), m_keywords, m_repl, and m_words_colors.
Referenced by run().
|
private |
Prompt the user to enter a complete code block and handle the prompt modifications until the code block is complete.
Definition at line 219 of file Repl.cpp.
References Ark::internal::countOpenEnclosures(), getLine(), m_line_count, and m_running.
Referenced by run().
|
private |
Get a line via replxx and handle commands.
| continuation | if the prompt needs to be modified because a code block isn't entirely closed, set to true |
Definition at line 156 of file Repl.cpp.
References m_code, m_has_init_vm, m_line_count, m_repl, m_running, m_state, Ark::State::reset(), and Ark::internal::trimWhitespace().
Referenced by getCodeBlock().
|
private |
Definition at line 121 of file Repl.cpp.
References Ark::types::check(), Ark::Utils::fileExists(), Ark::State::loadFunction(), m_code, m_state, m_temp_additional_code, Ark::Nil, Ark::Utils::readFile(), and Ark::String.
Referenced by run().
| int Ark::Repl::run | ( | ) |
Start the REPL.
Definition at line 28 of file Repl.cpp.
References ARK_BUILD_DATE, ARK_FULL_VERSION, cuiSetup(), Ark::DefaultFeatures, Ark::State::doString(), Ark::VM::forceReloadPlugins(), getCodeBlock(), Ark::VM::getDefaultContext(), Ark::VM::init(), Ark::InstPtr, m_code, Ark::VM::m_execution_contexts, m_has_init_vm, m_old_ip, m_running, m_state, m_temp_additional_code, m_vm, Ark::VM::peekAndResolveAsPtr(), Ark::Utils::readFile(), registerBuiltins(), Ark::State::reset(), Ark::VM::safeRun(), Ark::Value::toString(), Ark::Undefined, and Ark::Value::valueType().
Referenced by main().
|
private |
Definition at line 43 of file Repl.hpp.
Referenced by getLine(), registerBuiltins(), and run().
|
private |
|
private |
Definition at line 52 of file Repl.hpp.
Referenced by cuiSetup().
|
private |
|
private |
Definition at line 42 of file Repl.hpp.
Referenced by getCodeBlock(), and getLine().
|
private |
|
private |
Definition at line 41 of file Repl.hpp.
Referenced by cuiSetup(), and getLine().
|
private |
Definition at line 45 of file Repl.hpp.
Referenced by getCodeBlock(), getLine(), and run().
|
private |
Definition at line 49 of file Repl.hpp.
Referenced by getLine(), registerBuiltins(), and run().
|
private |
Definition at line 44 of file Repl.hpp.
Referenced by registerBuiltins(), and run().
|
private |
Definition at line 53 of file Repl.hpp.
Referenced by cuiSetup().