ArkScript
A small, fast, functional and scripting language for video games
Ark::Repl Class Reference

#include <Repl.hpp>

Collaboration diagram for Ark::Repl:
[legend]

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.
 
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
 
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
 

Detailed Description

Definition at line 25 of file Repl.hpp.

Constructor & Destructor Documentation

◆ Repl()

Ark::Repl::Repl ( const std::vector< std::filesystem::path > & lib_env)
explicit

Construct a new Repl object.

Parameters
lib_envsearch path for the std library

Member Function Documentation

◆ cuiSetup()

void Ark::Repl::cuiSetup ( )
private

Configure replxx.

◆ getCodeBlock()

std::optional< std::string > Ark::Repl::getCodeBlock ( )
private

Prompt the user to enter a complete code block and handle the prompt modifications until the code block is complete.

Returns
std::optional<std::string>

◆ getLine()

std::optional< std::string > Ark::Repl::getLine ( bool continuation)
private

Get a line via replxx and handle commands.

Parameters
continuationif the prompt needs to be modified because a code block isn't entirely closed, set to true
Returns

◆ run()

int Ark::Repl::run ( )

Start the REPL.

Referenced by main().

Member Data Documentation

◆ m_code

std::string Ark::Repl::m_code
private

Definition at line 44 of file Repl.hpp.

◆ m_has_init_vm

bool Ark::Repl::m_has_init_vm
private

Definition at line 51 of file Repl.hpp.

◆ m_keywords

std::vector<std::string> Ark::Repl::m_keywords
private

Definition at line 52 of file Repl.hpp.

◆ m_lib_env

std::vector<std::filesystem::path> Ark::Repl::m_lib_env
private

Definition at line 48 of file Repl.hpp.

◆ m_line_count

unsigned Ark::Repl::m_line_count
private

Definition at line 43 of file Repl.hpp.

◆ m_old_ip

std::size_t Ark::Repl::m_old_ip
private

Definition at line 47 of file Repl.hpp.

◆ m_repl

replxx::Replxx Ark::Repl::m_repl
private

Definition at line 42 of file Repl.hpp.

◆ m_running

bool Ark::Repl::m_running
private

Definition at line 45 of file Repl.hpp.

◆ m_state

State Ark::Repl::m_state
private

Definition at line 49 of file Repl.hpp.

◆ m_vm

VM Ark::Repl::m_vm
private

Definition at line 50 of file Repl.hpp.

◆ m_words_colors

std::vector<std::pair<std::string, replxx::Replxx::Color> > Ark::Repl::m_words_colors
private

Definition at line 53 of file Repl.hpp.


The documentation for this class was generated from the following file: