ArkScript
A small, fast, functional and scripting language for video games
|
#include <JsonCompiler.hpp>
Public Member Functions | |
JsonCompiler (unsigned debug, const std::vector< std::string > &libenv, uint16_t options=DefaultFeatures) | |
Construct a new JsonCompiler object. | |
void | feed (const std::string &code, const std::string &filename=ARK_NO_NAME_FILE) |
Feed the differents variables with information taken from the given source code file. | |
std::string | compile () |
Start the compilation. | |
Private Member Functions | |
std::string | _compile (const internal::Node &node) |
Compile a single node and return its representation. | |
std::string | toJsonList (const internal::Node &node, std::size_t start) |
Convert a NodeType::List to a JSON list. | |
Private Attributes | |
internal::Parser | m_parser |
internal::Optimizer | m_optimizer |
uint16_t | m_options |
unsigned | m_debug |
the debug level of the compiler | |
Definition at line 15 of file JsonCompiler.hpp.
Ark::JsonCompiler::JsonCompiler | ( | unsigned | debug, |
const std::vector< std::string > & | libenv, | ||
uint16_t | options = DefaultFeatures |
||
) |
Construct a new JsonCompiler object.
debug | the debug level |
options | the compilers options |
Definition at line 14 of file JsonCompiler.cpp.
|
private |
Compile a single node and return its representation.
node |
Definition at line 45 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(), Ark::string_format(), and toJsonList().
Referenced by _compile(), compile(), and toJsonList().
std::string Ark::JsonCompiler::compile | ( | ) |
Start the compilation.
Definition at line 28 of file JsonCompiler.cpp.
References _compile(), Ark::internal::Optimizer::ast(), and m_optimizer.
Referenced by main().
void Ark::JsonCompiler::feed | ( | const std::string & | code, |
const std::string & | filename = ARK_NO_NAME_FILE |
||
) |
Feed the differents variables with information taken from the given source code file.
code | the code of the file |
filename | the name of the file |
Definition at line 19 of file JsonCompiler.cpp.
References Ark::internal::Parser::ast(), Ark::internal::MacroProcessor::ast(), Ark::internal::Optimizer::feed(), Ark::internal::MacroProcessor::feed(), Ark::internal::Parser::feed(), m_debug, m_optimizer, m_options, and m_parser.
Referenced by main().
|
private |
Convert a NodeType::List to a JSON list.
node | |
start |
Definition at line 222 of file JsonCompiler.cpp.
References _compile(), and Ark::internal::Node::constList().
Referenced by _compile().
|
private |
the debug level of the compiler
Definition at line 45 of file JsonCompiler.hpp.
Referenced by feed().
|
private |
Definition at line 43 of file JsonCompiler.hpp.
|
private |
Definition at line 44 of file JsonCompiler.hpp.
Referenced by feed().
|
private |
Definition at line 42 of file JsonCompiler.hpp.
Referenced by feed().