From aa7be467e110de4d3757fc7e0697d89f397aea34 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sun, 8 Jan 2012 23:47:09 +1000 Subject: Rearrange everything, to be consistant order. --- LuaSL/src/LuaSL_LSL_tree.h | 180 ++++++++++++++++++++++++--------------------- 1 file changed, 98 insertions(+), 82 deletions(-) (limited to 'LuaSL/src/LuaSL_LSL_tree.h') diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h index 257f18b..adefa07 100644 --- a/LuaSL/src/LuaSL_LSL_tree.h +++ b/LuaSL/src/LuaSL_LSL_tree.h @@ -19,8 +19,24 @@ extern int yydebug; // http://w-hat.com/stackdepth is a useful discussion about some aspects of the LL parser. + +typedef union _LSL_Leaf LSL_Leaf; +typedef struct _LSL_Value LSL_Value; +typedef struct _LSL_Identifier LSL_Identifier; +typedef struct _LSL_Statement LSL_Statement; +typedef struct _LSL_Block LSL_Block; +typedef struct _LSL_Function LSL_Function; +typedef struct _LSL_State LSL_State; +typedef struct _LSL_Script LSL_Script; +typedef struct _LSL_AST LSL_AST; + +typedef int LSL_Type; + +typedef void (*convertToken2Lua) (LSL_Leaf *content); +typedef void (*outputToken) (LSL_Leaf *content); +typedef void (*evaluateToken) (LSL_Leaf *content, LSL_Value *left, LSL_Value *right); + #ifndef FALSE -// NEVER change this typedef enum { FALSE = 0, @@ -39,111 +55,111 @@ typedef enum LSL_CREATION = 32 } LSL_Flags; -typedef int LSL_Type; - typedef struct { - LSL_Type type; - struct LSL_AST *expression; -} LSL_Statement; + LSL_Type type; + char *token; + LSL_Flags flags; + outputToken output; + convertToken2Lua convert; + evaluateToken evaluate; +} LSL_Token; -typedef struct +union _LSL_Leaf { - LSL_Statement *statements; -} LSL_Block; - -typedef struct + char *commentValue; + char *spaceValue; + + LSL_Type operationValue; + LSL_AST *expressionValue; + + float floatValue; + int integerValue; + char *keyValue; + LSL_Leaf *listValue; + char *stringValue; + float vectorValue[3]; + float rotationValue[4]; + + LSL_Identifier *variableValue; + + char *labelValue; + LSL_Statement *doValue; + LSL_Statement *forValue; + LSL_Statement *elseIfValue; + LSL_Statement *elseValue; + LSL_Statement *ifValue; + char *jumpValue; + LSL_Statement *returnValue; + char *stateChangeValue; + LSL_Statement *whileValue; + LSL_Statement *statementValue; + + LSL_Block *blockValue; + LSL_Identifier *parameterValue; + LSL_Function *functionValue; + LSL_State *stateValue; + LSL_Script *scriptValue; + + char *unknownValue; +}; + +struct _LSL_Value { - char *name; - struct LSL_Identifier *parameters; - LSL_Block block; - LSL_Type type; -} LSL_Function; + LSL_Leaf content; + LSL_Type type; +}; -typedef struct +struct _LSL_Identifier // For variables and function parameters. { - char *name; - LSL_Function *handlers; -} LSL_State; + char *name; + LSL_Value value; +}; -typedef struct +struct _LSL_Statement { - char *name; - struct LSL_Identifier *variables; - LSL_Function *functions; - LSL_State *states; -} LSL_Script; + LSL_AST *expression; + LSL_Type type; +}; -typedef union LSL_Leaf +struct _LSL_Block { - char *spaceValue; - char *commentValue; - LSL_Type typeValue; - char *nameValue; - struct LSL_Identifier *identifierValue; - float floatValue; - int integerValue; - char *stringValue; - char *keyValue; - float vectorValue[3]; - float rotationValue[4]; - union LSL_Leaf *listValue; - char *labelValue; - LSL_Type operationValue; - struct LSL_AST *expressionValue; - LSL_Statement *doValue; - LSL_Statement *forValue; - LSL_Statement *ifValue; - LSL_Statement *elseValue; - LSL_Statement *elseIfValue; - char *jumpValue; - char *stateChangeValue; - LSL_Statement *statementValue; - struct LSL_Identifier *parameterValue; - LSL_Function *functionValue; - LSL_State *stateValue; - LSL_Script *scriptValue; - char *unknownValue; -} LSL_Leaf; + LSL_Statement *statements; +}; -typedef struct +struct _LSL_Function { + char *name; + LSL_Block block; + LSL_Identifier *parameters; LSL_Type type; - LSL_Leaf content; -} LSL_Value; - -typedef void (*convertToken2Lua) (LSL_Leaf *content); -typedef void (*outputToken) (LSL_Leaf *content); -typedef void (*evaluateToken) (LSL_Leaf *content, LSL_Value *left, LSL_Value *right); +}; -typedef struct +struct _LSL_State { - LSL_Type type; - char *token; - LSL_Flags flags; - outputToken output; - convertToken2Lua convert; - evaluateToken evaluate; -} LSL_Token; + char *name; + LSL_Function *handlers; +}; -typedef struct +struct _LSL_Script { char *name; - LSL_Type type; - LSL_Leaf content; -} LSL_Identifier; + LSL_Function *functions; + LSL_State *states; + LSL_Identifier *variables; +}; -typedef struct LSL_AST +struct _LSL_AST { - struct LSL_AST *left; - struct LSL_AST *right; - int line; - int character; + LSL_AST *left; + LSL_AST *right; LSL_Token *token; LSL_Leaf content; -} LSL_AST; + int line; + int character; +}; + - // define the type for flex and bison #define YYSTYPE LSL_Leaf -- cgit v1.1