ug4
ug::LUAParserClass Class Reference

#include <lua_parser_class.h>

Public Types

enum  { LUAParserError , LUAParserIgnore , LUAParserOK }
 
enum  eReturnType {
  RT_SUBFUNCTION , RT_DIFFUSION , RT_VELOCITY , RT_CALLBACK ,
  RT_DIRICHLET , RT_SOURCE , RT_NEUMANN
}
 

Public Member Functions

void add (nodeType *p)
 
int add_subfunction (std::string name, std::map< std::string, SmartPtr< LUAParserClass > > &subfunctions)
 
int add_subfunctions (std::map< std::string, SmartPtr< LUAParserClass > > &subfunctions)
 
int add_subfunctions (std::set< std::string > &knownFunctions, std::stringstream &declarations, std::stringstream &definitions)
 
void assert_local (size_t id)
 
void clear ()
 
int createC (nodeType *p, std::ostream &out, int indent)
 
int createC (std::ostream &out)
 
int createC_inline (std::ostream &out)
 
int createJITSG (std::ostream &out, eReturnType r, std::set< std::string > &subfunctions)
 
int createLUA (nodeType *p, std::ostream &out)
 
int createLUA (std::ostream &out)
 
int createRT (nodeType *a, std::ostream &out, const char **rt, int nr, int indent)
 
int createVM (nodeType *p, VMAdd &vm, std::map< std::string, SmartPtr< VMAdd > > &subVM)
 
int createVM (VMAdd &vm)
 
int createVMHeader (VMAdd &vm)
 
int createVMSub (VMAdd &vm, std::map< std::string, SmartPtr< VMAdd > > &subVM)
 
int declare (std::ostream &out)
 
nodeTypefunction (nodeType *op1, nodeType *op2)
 
int get_id_for_name (const char *name)
 
const char * get_name_for_id (size_t id)
 
void getVar (int i, std::ostream &out)
 
bool has_errors ()
 
bool is_arg (size_t id)
 
bool is_global (size_t id)
 
bool is_local (size_t id)
 
 LUAParserClass ()
 
int num_in ()
 
int num_out ()
 
nodeTypeopr1 (int oper, nodeType *op)
 
void parse (const char *command)
 
int parse_luaFunction (const char *name)
 
int parse_luaFunction (LuaFunctionHandle handle)
 
int parse_luaFunction_StackTop (const char *name)
 
void print_globals (std::ostream &out)
 
void print_locals (std::ostream &out)
 
void print_variable_names ()
 
void reduce ()
 
nodeTypereduce (nodeType *p)
 
void set_arguments (nodeType *p)
 
bool set_local (size_t id)
 
void set_name (const char *s)
 
void set_name (int id)
 
void setRet (int i)
 

Static Public Member Functions

static int addfunctionC (std::string name, std::set< std::string > &knownFunctions, std::stringstream &declarations, std::stringstream &definitions)
 
static nodeTypecon (double value)
 
static nodeTypeforOp (nodeType *_var, nodeType *_start, nodeType *_stop, nodeType *_step, nodeType *_expr)
 
static void freeNode (nodeType *p)
 
static nodeTypeid (int i)
 
static nodeTypeopr0 (int i)
 
static nodeTypeopr2 (int oper, nodeType *op1, nodeType *op2)
 
static nodeTypeopr3 (int oper, nodeType *op1, nodeType *op2, nodeType *op3)
 

Public Attributes

std::stringstream err
 
std::string filename
 
int iLineAdd
 
eReturnType returnType
 

Private Attributes

nodeTypeargs
 
std::map< size_t, std::string > id2variable
 
std::set< size_t > localFunctions
 
std::set< size_t > localVariables
 
std::string name
 
std::vector< nodeType * > nodes
 
int numOut
 
std::map< std::string, size_t > variables
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
LUAParserError 
LUAParserIgnore 
LUAParserOK 

◆ eReturnType

Enumerator
RT_SUBFUNCTION 
RT_DIFFUSION 
RT_VELOCITY 
RT_CALLBACK 
RT_DIRICHLET 
RT_SOURCE 
RT_NEUMANN 

Constructor & Destructor Documentation

◆ LUAParserClass()

ug::LUAParserClass::LUAParserClass ( )
inline

Member Function Documentation

◆ add()

void ug::LUAParserClass::add ( nodeType p)
inline

References nodes, and p.

◆ add_subfunction()

int ug::LUAParserClass::add_subfunction ( std::string  name,
std::map< std::string, SmartPtr< LUAParserClass > > &  subfunctions 
)

References ug::DID_LUACOMPILER, name, and UG_DLOG.

◆ add_subfunctions() [1/2]

int ug::LUAParserClass::add_subfunctions ( std::map< std::string, SmartPtr< LUAParserClass > > &  subfunctions)

◆ add_subfunctions() [2/2]

int ug::LUAParserClass::add_subfunctions ( std::set< std::string > &  knownFunctions,
std::stringstream &  declarations,
std::stringstream &  definitions 
)

◆ addfunctionC()

int ug::LUAParserClass::addfunctionC ( std::string  name,
std::set< std::string > &  knownFunctions,
std::stringstream &  declarations,
std::stringstream &  definitions 
)
static

◆ assert_local()

void ug::LUAParserClass::assert_local ( size_t  id)
inline

References err, get_name_for_id(), and is_local().

◆ clear()

void ug::LUAParserClass::clear ( )
inline

References err, id2variable, localVariables, nodes, and variables.

Referenced by parse().

◆ con()

static nodeType* ug::LUAParserClass::con ( double  value)
inlinestatic

References p, typeCon, and yyerror.

◆ createC() [1/2]

◆ createC() [2/2]

int ug::LUAParserClass::createC ( std::ostream &  out)

◆ createC_inline()

int ug::LUAParserClass::createC_inline ( std::ostream &  out)

◆ createJITSG()

int ug::LUAParserClass::createJITSG ( std::ostream &  out,
eReturnType  r,
std::set< std::string > &  subfunctions 
)

◆ createLUA() [1/2]

◆ createLUA() [2/2]

int ug::LUAParserClass::createLUA ( std::ostream &  out)

◆ createRT()

int ug::LUAParserClass::createRT ( nodeType a,
std::ostream &  out,
const char **  rt,
int  nr,
int  indent 
)

◆ createVM() [1/2]

◆ createVM() [2/2]

int ug::LUAParserClass::createVM ( VMAdd vm)

References name, and ug::VMAdd::set_name().

◆ createVMHeader()

int ug::LUAParserClass::createVMHeader ( VMAdd vm)

◆ createVMSub()

int ug::LUAParserClass::createVMSub ( VMAdd vm,
std::map< std::string, SmartPtr< VMAdd > > &  subVM 
)

◆ declare()

int ug::LUAParserClass::declare ( std::ostream &  out)

◆ forOp()

static nodeType* ug::LUAParserClass::forOp ( nodeType _var,
nodeType _start,
nodeType _stop,
nodeType _step,
nodeType _expr 
)
inlinestatic

References LUAPARSER_FOR, p, and typeOpr.

◆ freeNode()

static void ug::LUAParserClass::freeNode ( nodeType p)
inlinestatic

References p, and typeOpr.

◆ function()

nodeType* ug::LUAParserClass::function ( nodeType op1,
nodeType op2 
)
inline

References localFunctions, and opr2().

◆ get_id_for_name()

int ug::LUAParserClass::get_id_for_name ( const char *  name)

References name, and s.

◆ get_name_for_id()

const char* ug::LUAParserClass::get_name_for_id ( size_t  id)
inline

References id(), and id2variable.

Referenced by assert_local(), and set_name().

◆ getVar()

void ug::LUAParserClass::getVar ( int  i,
std::ostream &  out 
)

◆ has_errors()

bool ug::LUAParserClass::has_errors ( )
inline

References err.

◆ id()

static nodeType* ug::LUAParserClass::id ( int  i)
inlinestatic

References p, typeId, and yyerror.

Referenced by get_name_for_id().

◆ is_arg()

bool ug::LUAParserClass::is_arg ( size_t  id)
inline

◆ is_global()

bool ug::LUAParserClass::is_global ( size_t  id)
inline

References is_arg(), and is_local().

◆ is_local()

bool ug::LUAParserClass::is_local ( size_t  id)
inline

References localVariables.

Referenced by assert_local(), and is_global().

◆ num_in()

int ug::LUAParserClass::num_in ( )
inline

◆ num_out()

int ug::LUAParserClass::num_out ( )
inline

References numOut.

Referenced by ug::bridge::LUACompiler::createC().

◆ opr0()

static nodeType* ug::LUAParserClass::opr0 ( int  i)
inlinestatic

References p, and typeOpr.

◆ opr1()

nodeType* ug::LUAParserClass::opr1 ( int  oper,
nodeType op 
)
inline

◆ opr2()

static nodeType* ug::LUAParserClass::opr2 ( int  oper,
nodeType op1,
nodeType op2 
)
inlinestatic

References p, and typeOpr.

Referenced by function().

◆ opr3()

static nodeType* ug::LUAParserClass::opr3 ( int  oper,
nodeType op1,
nodeType op2,
nodeType op3 
)
inlinestatic

References p, and typeOpr.

◆ parse()

void ug::LUAParserClass::parse ( const char *  command)
inline

References clear(), and yaccparse().

◆ parse_luaFunction() [1/2]

◆ parse_luaFunction() [2/2]

int ug::LUAParserClass::parse_luaFunction ( LuaFunctionHandle  handle)

◆ parse_luaFunction_StackTop()

int ug::LUAParserClass::parse_luaFunction_StackTop ( const char *  name)

◆ print_globals()

void ug::LUAParserClass::print_globals ( std::ostream &  out)

◆ print_locals()

void ug::LUAParserClass::print_locals ( std::ostream &  out)

◆ print_variable_names()

void ug::LUAParserClass::print_variable_names ( )

References UG_LOG.

Referenced by ug::bridge::convertVM().

◆ reduce() [1/2]

void ug::LUAParserClass::reduce ( )

◆ reduce() [2/2]

◆ set_arguments()

void ug::LUAParserClass::set_arguments ( nodeType p)
inline

References args, and p.

◆ set_local()

bool ug::LUAParserClass::set_local ( size_t  id)
inline

References localVariables.

◆ set_name() [1/2]

void ug::LUAParserClass::set_name ( const char *  s)
inline

References name, and s.

Referenced by set_name().

◆ set_name() [2/2]

void ug::LUAParserClass::set_name ( int  id)
inline

References get_name_for_id(), and set_name().

◆ setRet()

void ug::LUAParserClass::setRet ( int  i)
inline

References err, and numOut.

Referenced by opr1().

Member Data Documentation

◆ args

nodeType* ug::LUAParserClass::args
private

◆ err

std::stringstream ug::LUAParserClass::err

◆ filename

std::string ug::LUAParserClass::filename

Referenced by LUAParserClass().

◆ id2variable

std::map<size_t, std::string> ug::LUAParserClass::id2variable
private

Referenced by clear(), and get_name_for_id().

◆ iLineAdd

int ug::LUAParserClass::iLineAdd

Referenced by LUAParserClass().

◆ localFunctions

std::set<size_t> ug::LUAParserClass::localFunctions
private

Referenced by function().

◆ localVariables

std::set<size_t> ug::LUAParserClass::localVariables
private

Referenced by clear(), is_local(), and set_local().

◆ name

std::string ug::LUAParserClass::name
private

Referenced by set_name().

◆ nodes

std::vector<nodeType *> ug::LUAParserClass::nodes
private

Referenced by add(), and clear().

◆ numOut

int ug::LUAParserClass::numOut
private

Referenced by LUAParserClass(), num_out(), and setRet().

◆ returnType

eReturnType ug::LUAParserClass::returnType

Referenced by LUAParserClass().

◆ variables

std::map<std::string, size_t> ug::LUAParserClass::variables
private

Referenced by clear().


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