ArkScript
A small, fast, functional and scripting language for video games
JsonCompiler Class Referencefinal

#include <JsonCompiler.hpp>

Collaboration diagram for JsonCompiler:
[legend]

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
 

Detailed Description

Definition at line 11 of file JsonCompiler.hpp.

Constructor & Destructor Documentation

◆ JsonCompiler()

JsonCompiler::JsonCompiler ( unsigned debug,
const std::vector< std::filesystem::path > & lib_env,
uint16_t features = 0 )

Construct a new JsonCompiler object.

Parameters
debugthe debug level
lib_envlist of path to the directories of the std lib
featurescompiler 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.

Member Function Documentation

◆ _compile()

std::string JsonCompiler::_compile ( const Ark::internal::Node & node)
private

◆ compile()

std::string JsonCompiler::compile ( )

Start the compilation.

Returns

Definition at line 22 of file JsonCompiler.cpp.

References _compile(), Ark::Welder::ast(), and m_welder.

Referenced by main().

◆ feed()

void JsonCompiler::feed ( const std::string & filename)

Feed the different variables with information taken from the given source code file.

Parameters
filenamethe name of the file

Definition at line 17 of file JsonCompiler.cpp.

References Ark::Welder::computeASTFromFile(), and m_welder.

Referenced by main().

◆ toJsonList()

std::string JsonCompiler::toJsonList ( const Ark::internal::Node & node,
std::size_t start )
private

Convert a NodeType::List to a JSON list.

Parameters
node
start
Returns
std::string

Definition at line 259 of file JsonCompiler.cpp.

References _compile(), and Ark::internal::Node::constList().

Referenced by _compile().

Member Data Documentation

◆ m_welder

Ark::Welder JsonCompiler::m_welder
private

Definition at line 38 of file JsonCompiler.hpp.

Referenced by compile(), and feed().


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