ug4
|
#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) |
nodeType * | function (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 () |
nodeType * | opr1 (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 () |
nodeType * | reduce (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 nodeType * | con (double value) |
static nodeType * | forOp (nodeType *_var, nodeType *_start, nodeType *_stop, nodeType *_step, nodeType *_expr) |
static void | freeNode (nodeType *p) |
static nodeType * | id (int i) |
static nodeType * | opr0 (int i) |
static nodeType * | opr2 (int oper, nodeType *op1, nodeType *op2) |
static nodeType * | opr3 (int oper, nodeType *op1, nodeType *op2, nodeType *op3) |
Public Attributes | |
std::stringstream | err |
std::string | filename |
int | iLineAdd |
eReturnType | returnType |
Private Attributes | |
nodeType * | args |
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 |
|
inline |
References args, filename, iLineAdd, numOut, returnType, and RT_CALLBACK.
int ug::LUAParserClass::add_subfunction | ( | std::string | name, |
std::map< std::string, SmartPtr< LUAParserClass > > & | subfunctions | ||
) |
References ug::DID_LUACOMPILER, name, and UG_DLOG.
int ug::LUAParserClass::add_subfunctions | ( | std::map< std::string, SmartPtr< LUAParserClass > > & | subfunctions | ) |
int ug::LUAParserClass::add_subfunctions | ( | std::set< std::string > & | knownFunctions, |
std::stringstream & | declarations, | ||
std::stringstream & | definitions | ||
) |
|
static |
|
inline |
References err, get_name_for_id(), and is_local().
|
inline |
References err, id2variable, localVariables, nodes, and variables.
Referenced by parse().
|
inlinestatic |
int ug::LUAParserClass::createC | ( | nodeType * | p, |
std::ostream & | out, | ||
int | indent | ||
) |
References LUAPARSER_BREAK, LUAPARSER_ELSE, LUAPARSER_ELSEIF, LUAPARSER_FOR, LUAPARSER_IF, LUAPARSER_MATH_ABS, LUAPARSER_MATH_CEIL, LUAPARSER_MATH_COS, LUAPARSER_MATH_EXP, LUAPARSER_MATH_FLOOR, LUAPARSER_MATH_LOG, LUAPARSER_MATH_LOG10, LUAPARSER_MATH_MAX, LUAPARSER_MATH_MIN, LUAPARSER_MATH_PI, LUAPARSER_MATH_POW, LUAPARSER_MATH_SIN, LUAPARSER_MATH_SQRT, LUAPARSER_UMINUS, oprNodeType::op, oprNodeType::oper, nodeType::opr, p, ug::repeat(), nodeType::type, typeCon, typeId, typeOpr, and UG_ASSERT.
Referenced by ug::bridge::convert(), and ug::bridge::LUACompiler::createC().
int ug::LUAParserClass::createC | ( | std::ostream & | out | ) |
int ug::LUAParserClass::createC_inline | ( | std::ostream & | out | ) |
int ug::LUAParserClass::createJITSG | ( | std::ostream & | out, |
eReturnType | r, | ||
std::set< std::string > & | subfunctions | ||
) |
References ug::DID_LUACOMPILER, idNodeType::i, nodeType::id, name, oprNodeType::op, nodeType::opr, PROFILE_BEGIN_GROUP, UG_ASSERT, and UG_DLOG.
int ug::LUAParserClass::createLUA | ( | nodeType * | p, |
std::ostream & | out | ||
) |
References LUAPARSER_IF, LUAPARSER_MATH_ABS, LUAPARSER_MATH_CEIL, LUAPARSER_MATH_COS, LUAPARSER_MATH_EXP, LUAPARSER_MATH_FLOOR, LUAPARSER_MATH_LOG, LUAPARSER_MATH_LOG10, LUAPARSER_MATH_MAX, LUAPARSER_MATH_MIN, LUAPARSER_MATH_POW, LUAPARSER_MATH_SIN, LUAPARSER_MATH_SQRT, LUAPARSER_UMINUS, oprNodeType::op, oprNodeType::oper, nodeType::opr, p, nodeType::type, typeCon, typeId, typeOpr, and UG_ASSERT.
int ug::LUAParserClass::createLUA | ( | std::ostream & | out | ) |
int ug::LUAParserClass::createRT | ( | nodeType * | a, |
std::ostream & | out, | ||
const char ** | rt, | ||
int | nr, | ||
int | indent | ||
) |
References oprNodeType::op, oprNodeType::oper, nodeType::opr, PROFILE_BEGIN_GROUP, ug::repeat(), nodeType::type, and typeOpr.
int ug::LUAParserClass::createVM | ( | nodeType * | p, |
VMAdd & | vm, | ||
std::map< std::string, SmartPtr< VMAdd > > & | subVM | ||
) |
References ug::VMAdd::adjust_jmp_pos(), ug::VMAdd::assign(), ug::VMAdd::binary(), ug::VMAdd::call(), ug::VMAdd::get_pos(), ug::script::GetDefaultLuaState(), ug::VMAdd::jmp(), ug::VMAdd::jmp_if_false(), ug::bridge::LuaGetNumber(), LUAPARSER_AND, LUAPARSER_BREAK, LUAPARSER_ELSE, LUAPARSER_ELSEIF, LUAPARSER_EQ, LUAPARSER_FOR, LUAPARSER_GE, LUAPARSER_IF, LUAPARSER_LE, LUAPARSER_MATH_ABS, LUAPARSER_MATH_CEIL, LUAPARSER_MATH_COS, LUAPARSER_MATH_EXP, LUAPARSER_MATH_FLOOR, LUAPARSER_MATH_LOG, LUAPARSER_MATH_LOG10, LUAPARSER_MATH_MAX, LUAPARSER_MATH_MIN, LUAPARSER_MATH_PI, LUAPARSER_MATH_POW, LUAPARSER_MATH_SIN, LUAPARSER_MATH_SQRT, LUAPARSER_NE, LUAPARSER_OR, LUAPARSER_UMINUS, oprNodeType::op, oprNodeType::oper, nodeType::opr, p, ug::VMAdd::push(), ug::VMAdd::push_var(), ug::VMAdd::ret(), nodeType::type, typeCon, typeId, typeOpr, UG_COND_THROW, UG_THROW, ug::VMAdd::unary(), and SmartPtr< T, FreePolicy >::valid().
Referenced by ug::bridge::convertVM(), and ug::bridge::LUACompiler::createVM().
int ug::LUAParserClass::createVM | ( | VMAdd & | vm | ) |
References name, and ug::VMAdd::set_name().
int ug::LUAParserClass::createVMHeader | ( | VMAdd & | vm | ) |
References oprNodeType::op, nodeType::opr, ug::VMAdd::set_in_out(), ug::VMAdd::set_nr_of_variables(), nodeType::type, and typeOpr.
int ug::LUAParserClass::createVMSub | ( | VMAdd & | vm, |
std::map< std::string, SmartPtr< VMAdd > > & | subVM | ||
) |
int ug::LUAParserClass::declare | ( | std::ostream & | out | ) |
|
inlinestatic |
References LUAPARSER_FOR, p, and typeOpr.
References localFunctions, and opr2().
|
inline |
References id(), and id2variable.
Referenced by assert_local(), and set_name().
void ug::LUAParserClass::getVar | ( | int | i, |
std::ostream & | out | ||
) |
References ug::script::GetDefaultLuaState(), ug::bridge::LuaGetNumber(), and PROFILE_BEGIN_GROUP.
|
inline |
References err.
|
inlinestatic |
References p, typeId, and yyerror.
Referenced by get_name_for_id().
|
inline |
References args, idNodeType::i, nodeType::id, oprNodeType::op, nodeType::opr, nodeType::type, and typeOpr.
Referenced by is_global().
|
inline |
References is_arg(), and is_local().
|
inline |
References localVariables.
Referenced by assert_local(), and is_global().
|
inline |
References args, oprNodeType::op, nodeType::opr, nodeType::type, and typeOpr.
Referenced by ug::bridge::LUACompiler::createC().
|
inline |
References numOut.
Referenced by ug::bridge::LUACompiler::createC().
References oprNodeType::op, oprNodeType::oper, nodeType::opr, p, setRet(), nodeType::type, and typeOpr.
Referenced by function().
|
inline |
References clear(), and yaccparse().
int ug::LUAParserClass::parse_luaFunction | ( | const char * | name | ) |
References ug::DID_LUACOMPILER, ug::script::GetDefaultLuaState(), ug::bridge::GetLuaNamespace(), LUA_STACK_CHECK, PROFILE_BEGIN_GROUP, PROFILE_FUNC, and UG_DLOG.
Referenced by ug::bridge::convert(), ug::bridge::convertVM(), ug::bridge::LUACompiler::createC(), and ug::bridge::LUACompiler::createVM().
int ug::LUAParserClass::parse_luaFunction | ( | LuaFunctionHandle | handle | ) |
References ug::DID_LUACOMPILER, ug::script::GetDefaultLuaState(), ug::LuaFunctionHandle::ref, and UG_DLOG.
int ug::LUAParserClass::parse_luaFunction_StackTop | ( | const char * | name | ) |
void ug::LUAParserClass::print_globals | ( | std::ostream & | out | ) |
void ug::LUAParserClass::print_locals | ( | std::ostream & | out | ) |
void ug::LUAParserClass::print_variable_names | ( | ) |
References UG_LOG.
Referenced by ug::bridge::convertVM().
void ug::LUAParserClass::reduce | ( | ) |
References PROFILE_BEGIN_GROUP, and PROFILE_FUNC.
|
inline |
References localVariables.
|
inline |
Referenced by set_name().
|
inline |
References get_name_for_id(), and set_name().
|
private |
Referenced by is_arg(), LUAParserClass(), num_in(), and set_arguments().
std::stringstream ug::LUAParserClass::err |
Referenced by assert_local(), clear(), has_errors(), setRet(), and yyerror().
std::string ug::LUAParserClass::filename |
Referenced by LUAParserClass().
|
private |
Referenced by clear(), and get_name_for_id().
int ug::LUAParserClass::iLineAdd |
Referenced by LUAParserClass().
|
private |
Referenced by function().
|
private |
Referenced by clear(), is_local(), and set_local().
|
private |
Referenced by set_name().
|
private |
Referenced by LUAParserClass(), num_out(), and setRet().
eReturnType ug::LUAParserClass::returnType |
Referenced by LUAParserClass().
|
private |
Referenced by clear().