From 4475fbd8d0c40f42aa7e14ccb5fbec59b31e4b4c Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Thu, 5 Jan 2012 10:10:50 +1000 Subject: Consolidate the parser includes. --- LuaSL/src/LuaSL_LSL_tree.h | 59 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) (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 71d372e..9c27a8f 100644 --- a/LuaSL/src/LuaSL_LSL_tree.h +++ b/LuaSL/src/LuaSL_LSL_tree.h @@ -4,6 +4,11 @@ #ifndef __EXPRESSION_H__ #define __EXPRESSION_H__ +#ifndef YY_NO_UNISTD_H +#define YY_NO_UNISTD_H 1 +#endif // YY_NO_UNISTD_H + + /** * @brief The operation type */ @@ -27,6 +32,57 @@ typedef struct tagSExpression } SExpression; /** + * @brief The structure used by flex and bison + */ +typedef union tagTypeParser +{ + SExpression *expression; + int value; + int ival; + float fval; + char *sval; +// class LLScriptType *type; +// class LLScriptConstant *constant; +// class LLScriptIdentifier *identifier; +// class LLScriptSimpleAssignable *assignable; +// class LLScriptGlobalVariable *global; +// class LLScriptEvent *event; +// class LLScriptEventHandler *handler; +// class LLScriptExpression *expression; +// class LLScriptStatement *statement; +// class LLScriptGlobalFunctions *global_funcs; +// class LLScriptFunctionDec *global_decl; +// class LLScriptState *state; +// class LLScritpGlobalStorage *global_store; +// class LLScriptScript *script; +}STypeParser; + +// define the type for flex and bison +#define YYSTYPE STypeParser + + +#ifndef excludeLexer + #include "LuaSL_lexer.h" +#endif + + +/** + * @brief structure given as argument to the reentrant 'yyparse' function. + */ +typedef struct tagSParserParam +{ + yyscan_t scanner; + SExpression *expression; +}SParserParam; + +// the parameter name (of the reentrant 'yyparse' function) +// data is a pointer to a 'SParserParam' structure +#define YYPARSE_PARAM data + +// the argument for the 'yylex' function +#define YYLEX_PARAM ((SParserParam*)data)->scanner + +/** * @brief It creates an identifier * @param value The number value * @return The expression or NULL in case of no memory @@ -55,5 +111,8 @@ int evaluate(SExpression *e); int yyerror(const char *msg); int yyparse(void *param); +#include "LuaSL_yaccer.tab.h" + + #endif // __EXPRESSION_H__ -- cgit v1.1