X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Flibspiderscript.so_src%2Fast.h;h=05ed68bf7a5554c43d4febd1f777124c1004aac4;hb=ec6f426069129f0a3d207f743ecddceddb57db8e;hp=9179563626f4b3e001857e956b8c17a3268864bc;hpb=1529dadb6c2170bf9899fbde46d06a3d9a392b52;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/libspiderscript.so_src/ast.h b/Usermode/Libraries/libspiderscript.so_src/ast.h index 91795636..05ed68bf 100644 --- a/Usermode/Libraries/libspiderscript.so_src/ast.h +++ b/Usermode/Libraries/libspiderscript.so_src/ast.h @@ -34,6 +34,9 @@ enum eAST_NodeTypes NODETYPE_ASSIGN, //!< Variable assignment operator NODETYPE_FUNCTIONCALL, //!< Call a function + NODETYPE_IF, //!< Conditional + NODETYPE_LOOP, //!< Looping Construct + NODETYPE_INDEX, //!< Index into an array NODETYPE_LOGICALAND, //!< Logical AND operator @@ -119,6 +122,20 @@ struct sAST_Node char Name[]; } FunctionCall; + struct { + tAST_Node *Condition; + tAST_Node *True; + tAST_Node *False; + } If; + + struct { + tAST_Node *Init; + int bCheckAfter; + tAST_Node *Condition; + tAST_Node *Increment; + tAST_Node *Code; + } For; + /** * \note Used for \a NODETYPE_VARIABLE and \a NODETYPE_CONSTANT */ @@ -153,13 +170,14 @@ struct sAST_BlockState tAST_BlockState *Parent; tSpiderScript *Script; //!< Script tAST_Variable *FirstVar; //!< First variable in the list + tSpiderValue *RetVal; }; struct sAST_Variable { tAST_Variable *Next; int Type; // Only used for static typing - tSpiderObject *Object; + tSpiderValue *Object; char Name[]; }; @@ -180,6 +198,9 @@ extern void AST_AppendFunctionCallArg(tAST_Node *Node, tAST_Node *Arg); extern tAST_Node *AST_NewCodeBlock(void); extern void AST_AppendNode(tAST_Node *Parent, tAST_Node *Child); + +extern tAST_Node *AST_NewIf(tAST_Node *Condition, tAST_Node *True, tAST_Node *False); + extern tAST_Node *AST_NewAssign(int Operation, tAST_Node *Dest, tAST_Node *Value); extern tAST_Node *AST_NewBinOp(int Operation, tAST_Node *Left, tAST_Node *Right); extern tAST_Node *AST_NewUniOp(int Operation, tAST_Node *Value); @@ -187,6 +208,6 @@ extern tAST_Node *AST_NewUniOp(int Operation, tAST_Node *Value); extern void AST_FreeNode(tAST_Node *Node); // exec_ast.h -extern tSpiderObject *AST_ExecuteNode(tAST_BlockState *Block, tAST_Node *Node); +extern tSpiderValue *AST_ExecuteNode(tAST_BlockState *Block, tAST_Node *Node); #endif