33 #ifndef LUAParserClass_H
34 #define LUAParserClass_H
51 #define THE_PREFIX ug4_lua_YY_
52 #define yyerror ug4_lua_YY_error
177 if(a->
opr.
op[0]->
id.
i == (
int)
id)
return true;
180 if(a->
id.
i == (
int)
id)
return true;
195 return err.str().length() != 0;
220 int add_subfunctions(std::set<std::string> &knownFunctions, std::stringstream &declarations, std::stringstream &definitions);
221 static int addfunctionC(std::string
name, std::set<std::string> &knownFunctions, std::stringstream &declarations, std::stringstream &definitions);
223 void getVar(
int i, std::ostream &out);
228 int declare(std::ostream &out);
231 int createRT(
nodeType *a, std::ostream &out,
const char **rt,
int nr,
int indent);
245 int createC(std::ostream &out);
265 p->con.value = value;
302 err <<
"different return values: was " <<
numOut <<
", now " << i <<
"\n";
369 p->opr.op[1] = _start;
370 p->opr.op[2] = _stop;
371 p->opr.op[3] = _step;
372 p->opr.op[4] = _expr;
380 return opr2(
'C', op1, op2);
390 for (i = 0; i <
p->opr.nops; i++)
Definition: smart_pointer.h:108
Definition: lua_parser_class.h:65
int declare(std::ostream &out)
Definition: lua_parser_class_create_c.cpp:415
int numOut
Definition: lua_parser_class.h:73
static nodeType * id(int i)
Definition: lua_parser_class.h:281
int num_out()
Definition: lua_parser_class.h:210
void print_variable_names()
Definition: lua_parser_class.cpp:77
int num_in()
Definition: lua_parser_class.h:198
static void freeNode(nodeType *p)
Definition: lua_parser_class.h:383
const char * get_name_for_id(size_t id)
Definition: lua_parser_class.h:144
int createC(nodeType *p, std::ostream &out, int indent)
Definition: lua_parser_class_create_c.cpp:41
void set_arguments(nodeType *p)
Definition: lua_parser_class.h:114
int iLineAdd
Definition: lua_parser_class.h:82
void add(nodeType *p)
Definition: lua_parser_class.h:122
int createLUA(nodeType *p, std::ostream &out)
Definition: lua_parser_class_create_lua.cpp:40
eReturnType
Definition: lua_parser_class.h:86
@ RT_SOURCE
Definition: lua_parser_class.h:88
@ RT_VELOCITY
Definition: lua_parser_class.h:87
@ RT_CALLBACK
Definition: lua_parser_class.h:87
@ RT_NEUMANN
Definition: lua_parser_class.h:88
@ RT_SUBFUNCTION
Definition: lua_parser_class.h:87
@ RT_DIFFUSION
Definition: lua_parser_class.h:87
@ RT_DIRICHLET
Definition: lua_parser_class.h:87
bool set_local(size_t id)
Definition: lua_parser_class.h:153
void parse(const char *command)
Definition: lua_parser_class.h:127
std::string name
Definition: lua_parser_class.h:72
int createC_inline(std::ostream &out)
Definition: lua_parser_class_create_c.cpp:353
std::set< size_t > localVariables
Definition: lua_parser_class.h:68
std::stringstream err
Definition: lua_parser_class.h:119
nodeType * args
Definition: lua_parser_class.h:74
bool is_global(size_t id)
Definition: lua_parser_class.h:160
int get_id_for_name(const char *name)
Definition: lua_parser_class.cpp:63
int createVMSub(VMAdd &vm, std::map< std::string, SmartPtr< VMAdd > > &subVM)
Definition: lua_parser_class_create_vm.cpp:274
static nodeType * opr2(int oper, nodeType *op1, nodeType *op2)
Definition: lua_parser_class.h:330
void print_locals(std::ostream &out)
Definition: lua_parser_class.cpp:265
std::set< size_t > localFunctions
Definition: lua_parser_class.h:69
int add_subfunction(std::string name, std::map< std::string, SmartPtr< LUAParserClass > > &subfunctions)
Definition: lua_parser_class_create_vm.cpp:289
std::string filename
Definition: lua_parser_class.h:83
void set_name(int id)
Definition: lua_parser_class.h:107
void reduce()
Definition: lua_parser_class.cpp:125
LUAParserClass()
Definition: lua_parser_class.h:92
void setRet(int i)
Definition: lua_parser_class.h:297
static nodeType * forOp(nodeType *_var, nodeType *_start, nodeType *_stop, nodeType *_step, nodeType *_expr)
Definition: lua_parser_class.h:359
bool has_errors()
Definition: lua_parser_class.h:193
void assert_local(size_t id)
Definition: lua_parser_class.h:186
std::map< size_t, std::string > id2variable
Definition: lua_parser_class.h:67
int createVM(nodeType *p, VMAdd &vm, std::map< std::string, SmartPtr< VMAdd > > &subVM)
Definition: lua_parser_class_create_vm.cpp:42
static int addfunctionC(std::string name, std::set< std::string > &knownFunctions, std::stringstream &declarations, std::stringstream &definitions)
Definition: lua_parser_class_create_c.cpp:372
nodeType * opr1(int oper, nodeType *op)
Definition: lua_parser_class.h:305
void print_globals(std::ostream &out)
Definition: lua_parser_class.cpp:273
int createJITSG(std::ostream &out, eReturnType r, std::set< std::string > &subfunctions)
Definition: lua_parser_class_create_jitsg.cpp:42
void clear()
Definition: lua_parser_class.h:134
int createVMHeader(VMAdd &vm)
Definition: lua_parser_class_create_vm.cpp:255
int add_subfunctions(std::map< std::string, SmartPtr< LUAParserClass > > &subfunctions)
Definition: lua_parser_class_create_vm.cpp:282
std::vector< nodeType * > nodes
Definition: lua_parser_class.h:71
bool is_local(size_t id)
Definition: lua_parser_class.h:166
int parse_luaFunction(const char *name)
Definition: lua_parser_class.cpp:169
int parse_luaFunction_StackTop(const char *name)
Definition: lua_parser_class.cpp:190
std::map< std::string, size_t > variables
Definition: lua_parser_class.h:66
static nodeType * opr0(int i)
Definition: lua_parser_class.h:271
int createRT(nodeType *a, std::ostream &out, const char **rt, int nr, int indent)
Definition: lua_parser_class.cpp:104
static nodeType * opr3(int oper, nodeType *op1, nodeType *op2, nodeType *op3)
Definition: lua_parser_class.h:344
bool is_arg(size_t id)
Definition: lua_parser_class.h:172
eReturnType returnType
Definition: lua_parser_class.h:90
static nodeType * con(double value)
Definition: lua_parser_class.h:255
void set_name(const char *s)
Definition: lua_parser_class.h:102
void getVar(int i, std::ostream &out)
Definition: lua_parser_class.cpp:85
int add_subfunctions(std::set< std::string > &knownFunctions, std::stringstream &declarations, std::stringstream &definitions)
@ LUAParserIgnore
Definition: lua_parser_class.h:79
@ LUAParserError
Definition: lua_parser_class.h:79
@ LUAParserOK
Definition: lua_parser_class.h:79
Handle for a lua reference.
Definition: lua_function_handle.h:40
--> documentation in vm.doxygen <–///
Definition: vm.h:49
void yaccparse(const char *command, ug::LUAParserClass *p)
Definition: parser.cpp:2102
#define yyerror
Definition: lua_parser_class.h:52
#define LUAPARSER_FOR
Definition: parser.cpp:140
@ typeOpr
Definition: parser_node.h:37
@ typeId
Definition: parser_node.h:37
@ typeCon
Definition: parser_node.h:37
int i
Definition: parser_node.h:46
Definition: parser_node.h:59
nodeEnum type
Definition: parser_node.h:61
idNodeType id
Definition: parser_node.h:65
oprNodeType opr
Definition: parser_node.h:66
nodeType ** op
Definition: parser_node.h:55
int oper
Definition: parser_node.h:53