From d4b977d0904a1dea37922dac60d3bb37f9769230 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Thu, 5 Jan 2012 04:47:56 +1000 Subject: Add a simple flex + btyacc stub. Will be fleshed out soon with LSL grammer. --- LuaSL/src/LuaSL_parser_param.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 LuaSL/src/LuaSL_parser_param.h (limited to 'LuaSL/src/LuaSL_parser_param.h') diff --git a/LuaSL/src/LuaSL_parser_param.h b/LuaSL/src/LuaSL_parser_param.h new file mode 100644 index 0000000..944a671 --- /dev/null +++ b/LuaSL/src/LuaSL_parser_param.h @@ -0,0 +1,38 @@ +/* + * ParserParam.h + * Definitions of the parameters for the reentrant functions + * of flex (yylex) and bison (yyparse) + */ + +// Since in this sample we use the reentrant version of both flex and yacc we are forced to provide parameters for the yylex function, when called from yyparse. + +#ifndef __PARSERPARAM_H__ +#define __PARSERPARAM_H__ + +#ifndef YY_NO_UNISTD_H +#define YY_NO_UNISTD_H 1 +#endif // YY_NO_UNISTD_H + +#include "LuaSL_type_parser.h" +#include "LuaSL_lexer.h" +#include "LuaSL_LSL_tree.h" + +/** + * @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 + +#endif // __PARSERPARAM_H__ + + -- cgit v1.1