![]() |
ArkScript
A small, fast, functional and scripting language for video games
|
#include <JsonCompiler.hpp>
Public Member Functions | |
JsonCompiler (unsigned debug, const std::vector< std::filesystem::path > &lib_env, uint16_t features=0) | |
Construct a new JsonCompiler object. | |
void | feed (const std::string &filename) |
Feed the different variables with information taken from the given source code file. | |
std::string | compile () |
Start the compilation. | |
Private Member Functions | |
std::string | _compile (const Ark::internal::Node &node) |
Compile a single node and return its representation. | |
std::string | toJsonList (const Ark::internal::Node &node, std::size_t start) |
Convert a NodeType::List to a JSON list. | |
Private Attributes | |
Ark::Welder | m_welder |
Definition at line 11 of file JsonCompiler.hpp.
JsonCompiler::JsonCompiler | ( | unsigned | debug, |
const std::vector< std::filesystem::path > & | lib_env, | ||
uint16_t | features = 0 ) |
Construct a new JsonCompiler object.
debug | the debug level |
lib_env | list of path to the directories of the std lib |
features | compiler features to enable. By default, none are active to be able to dump a file AST without any processing |
Definition at line 13 of file JsonCompiler.cpp.
|
private |
Compile a single node and return its representation.
node |
Definition at line 27 of file JsonCompiler.cpp.
References _compile(), Ark::internal::Node::col(), Ark::internal::Node::constList(), Ark::internal::Node::filename(), Ark::internal::Node::keyword(), Ark::internal::Node::line(), Ark::internal::Node::nodeType(), Ark::internal::nodeTypes, Ark::internal::Node::number(), Ark::internal::Node::string(), and toJsonList().
Referenced by _compile(), compile(), and toJsonList().
std::string JsonCompiler::compile | ( | ) |
Start the compilation.
Definition at line 22 of file JsonCompiler.cpp.
References _compile(), Ark::Welder::ast(), and m_welder.
Referenced by main().
void JsonCompiler::feed | ( | const std::string & | filename | ) |
Feed the different variables with information taken from the given source code file.
filename | the name of the file |
Definition at line 17 of file JsonCompiler.cpp.
References Ark::Welder::computeASTFromFile(), and m_welder.
Referenced by main().
|
private |
Convert a NodeType::List to a JSON list.
node | |
start |
Definition at line 259 of file JsonCompiler.cpp.
References _compile(), and Ark::internal::Node::constList().
Referenced by _compile().
|
private |
Definition at line 38 of file JsonCompiler.hpp.