From a386c57261b44a02f1d23b533f3220730d18e6ac Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Thu, 5 Jan 2012 07:27:45 +1000 Subject: Added the unadulterated flex and bison source files from the SL viewer. Actually, from meta-impy, but originaly from one of the SL viewers. They actually produce C files, though some of it is C++. The resulting files wont compile without lots of C++ files from the viewer. Still, it's a step in the right direction. "btyacc: 88 reduce/reduce conflicts." might be a worry though. --- LuaSL/src/LuaSL_LSL_yaccer.y | 1798 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1798 insertions(+) create mode 100644 LuaSL/src/LuaSL_LSL_yaccer.y (limited to 'LuaSL/src/LuaSL_LSL_yaccer.y') diff --git a/LuaSL/src/LuaSL_LSL_yaccer.y b/LuaSL/src/LuaSL_LSL_yaccer.y new file mode 100644 index 0000000..e4b10ff --- /dev/null +++ b/LuaSL/src/LuaSL_LSL_yaccer.y @@ -0,0 +1,1798 @@ +%{ + #include "linden_common.h" + #include "lscript_tree.h" + + #ifdef __cplusplus + extern "C" { + #endif + + int yylex(void); + int yyparse( void ); + int yyerror(const char *fmt, ...); + + #if LL_LINUX + // broken yacc codegen... --ryan. + #define getenv getenv_workaround + #endif + + #ifdef LL_WINDOWS + #pragma warning (disable : 4702) // warning C4702: unreachable code + #pragma warning( disable : 4065 ) // warning: switch statement contains 'default' but no 'case' labels + #endif + + #ifdef __cplusplus + } + #endif +%} + +%union +{ + S32 ival; + F32 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; +}; + +%token INTEGER +%token FLOAT_TYPE +%token STRING +%token LLKEY +%token VECTOR +%token QUATERNION +%token LIST + +%token STATE +%token EVENT +%token JUMP +%token RETURN + +%token STATE_ENTRY +%token STATE_EXIT +%token TOUCH_START +%token TOUCH +%token TOUCH_END +%token COLLISION_START +%token COLLISION +%token COLLISION_END +%token LAND_COLLISION_START +%token LAND_COLLISION +%token LAND_COLLISION_END +%token TIMER +%token CHAT +%token SENSOR +%token NO_SENSOR +%token CONTROL +%token AT_TARGET +%token NOT_AT_TARGET +%token AT_ROT_TARGET +%token NOT_AT_ROT_TARGET +%token MONEY +%token EMAIL +%token RUN_TIME_PERMISSIONS +%token INVENTORY +%token ATTACH +%token DATASERVER +%token MOVING_START +%token MOVING_END +%token REZ +%token OBJECT_REZ +%token LINK_MESSAGE +%token REMOTE_DATA +%token HTTP_RESPONSE +%token HTTP_REQUEST + +%token IDENTIFIER +%token STATE_DEFAULT + +%token INTEGER_CONSTANT +%token INTEGER_TRUE +%token INTEGER_FALSE + +%token FP_CONSTANT + +%token STRING_CONSTANT + +%token INC_OP +%token DEC_OP +%token ADD_ASSIGN +%token SUB_ASSIGN +%token MUL_ASSIGN +%token DIV_ASSIGN +%token MOD_ASSIGN + +%token EQ +%token NEQ +%token GEQ +%token LEQ + +%token BOOLEAN_AND +%token BOOLEAN_OR + +%token SHIFT_LEFT +%token SHIFT_RIGHT + +%token IF +%token ELSE +%token FOR +%token DO +%token WHILE + +%token PRINT + +%token PERIOD + +%token ZERO_VECTOR +%token ZERO_ROTATION + +%token TOUCH_INVALID_VECTOR +%token TOUCH_INVALID_TEXCOORD + +%nonassoc LOWER_THAN_ELSE +%nonassoc ELSE + + +%type