Imported existing code
This commit is contained in:
174
indra/lscript/lscript_compile/CMakeLists.txt
Normal file
174
indra/lscript/lscript_compile/CMakeLists.txt
Normal file
@@ -0,0 +1,174 @@
|
||||
# -*- cmake -*-
|
||||
|
||||
include(00-Common)
|
||||
include(LLCommon)
|
||||
include(LLMath)
|
||||
include(LLMessage)
|
||||
include(LLInventory)
|
||||
include(LScript)
|
||||
|
||||
include(FindCygwin)
|
||||
|
||||
find_program(FLEX flex
|
||||
"C:/Program Files/GnuWin32/bin"
|
||||
${CYGWIN_INSTALL_PATH}/bin
|
||||
/bin
|
||||
/usr/bin
|
||||
/usr/local/bin
|
||||
)
|
||||
mark_as_advanced(FLEX)
|
||||
|
||||
find_program(BISON bison
|
||||
"C:/Program Files/GnuWin32/bin"
|
||||
${CYGWIN_INSTALL_PATH}/bin
|
||||
/bin
|
||||
/usr/bin
|
||||
/usr/local/bin
|
||||
)
|
||||
mark_as_advanced(BISON)
|
||||
|
||||
find_program(M4 m4
|
||||
"C:/Program Files/GnuWin32/bin"
|
||||
${CYGWIN_INSTALL_PATH}/bin
|
||||
/bin
|
||||
/usr/bin
|
||||
/usr/local/bin
|
||||
)
|
||||
mark_as_advanced(M4)
|
||||
|
||||
include_directories(
|
||||
${LLCOMMON_INCLUDE_DIRS}
|
||||
${LLMATH_INCLUDE_DIRS}
|
||||
${LLMESSAGE_INCLUDE_DIRS}
|
||||
${LLINVENTORY_INCLUDE_DIRS}
|
||||
${LSCRIPT_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(lscript_generated_SOURCE_FILES
|
||||
indra.l.cpp
|
||||
indra.y.cpp
|
||||
)
|
||||
|
||||
set(lscript_compile_SOURCE_FILES
|
||||
lscript_alloc.cpp
|
||||
lscript_bytecode.cpp
|
||||
lscript_error.cpp
|
||||
lscript_heap.cpp
|
||||
lscript_resource.cpp
|
||||
lscript_scope.cpp
|
||||
lscript_tree.cpp
|
||||
lscript_typecheck.cpp
|
||||
)
|
||||
|
||||
set(lscript_compile_HEADER_FILES
|
||||
CMakeLists.txt
|
||||
|
||||
indra.l
|
||||
indra.y
|
||||
|
||||
../lscript_alloc.h
|
||||
../lscript_byteformat.h
|
||||
../lscript_byteconvert.h
|
||||
../lscript_http.h
|
||||
|
||||
lscript_error.h
|
||||
lscript_bytecode.h
|
||||
lscript_heap.h
|
||||
lscript_resource.h
|
||||
lscript_scope.h
|
||||
lscript_tree.h
|
||||
lscript_typecheck.h
|
||||
)
|
||||
|
||||
set_source_files_properties(${lscript_compile_HEADER_FILES}
|
||||
PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
|
||||
set_source_files_properties(${lscript_generated_SOURCE_FILES}
|
||||
PROPERTIES HEADER_FILE_ONLY FALSE GENERATED TRUE)
|
||||
|
||||
list(APPEND lscript_compile_SOURCE_FILES ${lscript_generated_SOURCE_FILES} ${lscript_compile_HEADER_FILES})
|
||||
|
||||
if(FLEX)
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${CMAKE_CURRENT_BINARY_DIR}/indra.l.cpp
|
||||
COMMAND ${FLEX}
|
||||
ARGS
|
||||
-o${CMAKE_CURRENT_BINARY_DIR}/indra.l.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/indra.l
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/indra.l
|
||||
)
|
||||
else(FLEX)
|
||||
message(STATUS "FLEX not found, using pre-generated lexer")
|
||||
add_custom_command(
|
||||
COMMENT "Copying pre-generated indra.l.cpp"
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/indra.l.cpp
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/indra_generated.l.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/indra.l.cpp
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/indra_generated.l.cpp
|
||||
)
|
||||
endif(FLEX)
|
||||
|
||||
if (WINDOWS)
|
||||
set_source_files_properties(indra.l.cpp
|
||||
PROPERTIES COMPILE_FLAGS /DYY_NO_UNISTD_H)
|
||||
endif (WINDOWS)
|
||||
|
||||
if(BISON)
|
||||
if (WINDOWS)
|
||||
get_filename_component(M4_PATH ${M4} PATH)
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bison.bat
|
||||
${BISON} ${M4_PATH}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/indra.y
|
||||
DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/bison.bat
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/indra.y
|
||||
)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/windows)
|
||||
else (WINDOWS)
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp
|
||||
COMMAND
|
||||
${BISON}
|
||||
ARGS
|
||||
-d -o ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/indra.y
|
||||
DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/indra.y
|
||||
)
|
||||
endif (WINDOWS)
|
||||
|
||||
if (DARWIN)
|
||||
# Mac OS X 10.4 compatibility
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp
|
||||
COMMAND
|
||||
mv
|
||||
${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp
|
||||
)
|
||||
endif (DARWIN)
|
||||
else(BISON)
|
||||
message(STATUS "BISON not found, using pre-generated parser")
|
||||
add_custom_command(
|
||||
COMMENT "Copying pre-generated indra.y.cpp, indra.y.hpp"
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/indra_generated.y.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/indra_generated.y.hpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/indra_generated.l.cpp
|
||||
)
|
||||
endif(BISON)
|
||||
|
||||
add_library (lscript_compile ${lscript_compile_SOURCE_FILES})
|
||||
add_dependencies(lscript_compile prepare)
|
||||
11
indra/lscript/lscript_compile/bison.bat
Normal file
11
indra/lscript/lscript_compile/bison.bat
Normal file
@@ -0,0 +1,11 @@
|
||||
@REM Run bison under Windows. This script is needed so that bison can
|
||||
@REM find m4, even if neither program is present in PATH.
|
||||
|
||||
@set bison=%1
|
||||
set M4PATH=%2
|
||||
set M4=
|
||||
@set output=%3
|
||||
@set input=%4
|
||||
|
||||
set PATH=%M4PATH%;%PATH%
|
||||
%bison% -d -o %output% %input%
|
||||
904
indra/lscript/lscript_compile/indra.l
Normal file
904
indra/lscript/lscript_compile/indra.l
Normal file
@@ -0,0 +1,904 @@
|
||||
|
||||
N [0-9]
|
||||
L [a-zA-Z_]
|
||||
H [a-fA-F0-9]
|
||||
E [Ee][+-]?{N}+
|
||||
FS (f|F)
|
||||
%e 10000
|
||||
%n 4000
|
||||
%p 5000
|
||||
|
||||
%{
|
||||
// We maintain a pre-generated lexer source file to simplify user builds.
|
||||
// Before committing changes to this file, manually run
|
||||
//
|
||||
// flex -o indra_generated.l.cpp indra.l
|
||||
//
|
||||
// to update the pre-generated lexer. Then commit all files simultaneously.
|
||||
#include "linden_common.h"
|
||||
// Deal with the fact that lex/yacc generates unreachable code
|
||||
#ifdef LL_WINDOWS
|
||||
#pragma warning (disable : 4018) // warning C4018: signed/unsigned mismatch
|
||||
#pragma warning (disable : 4702) // warning C4702: unreachable code
|
||||
#endif // LL_WINDOWS
|
||||
#include "llmath.h"
|
||||
#include "lscript_tree.h"
|
||||
#include "lscript_typecheck.h"
|
||||
#include "lscript_resource.h"
|
||||
#include "indra.y.hpp"
|
||||
#include "lltimer.h"
|
||||
#include "indra_constants.h"
|
||||
#include "llagentconstants.h"
|
||||
#include "lllslconstants.h"
|
||||
#include "lluuid.h"
|
||||
#include "llassetstorage.h"
|
||||
#include "llpartdata.h"
|
||||
#include "llvehicleparams.h"
|
||||
#include "llpermissionsflags.h"
|
||||
#include "llfollowcamparams.h"
|
||||
#include "llparcelflags.h"
|
||||
#include "llregionflags.h"
|
||||
#include "lscript_http.h"
|
||||
#include "llclickaction.h"
|
||||
|
||||
void count();
|
||||
void line_comment();
|
||||
void block_comment();
|
||||
void parse_string();
|
||||
|
||||
#define YYLMAX 16384
|
||||
#define YY_NEVER_INTERACTIVE 1 /* stops flex from calling isatty() */
|
||||
#ifdef LL_WINDOWS
|
||||
#define isatty(x) 0 /* hack for bug in cygwin flex 2.5.35 */
|
||||
#endif
|
||||
|
||||
#ifdef ECHO
|
||||
#undef ECHO
|
||||
#endif
|
||||
|
||||
#define ECHO do { } while (0)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" { int yylex( void ); }
|
||||
extern "C" { int yyparse( void ); }
|
||||
extern "C" { int yyerror(const char *fmt, ...); }
|
||||
#endif
|
||||
|
||||
%}
|
||||
|
||||
%%
|
||||
"//" { gInternalLine++; gInternalColumn = 0; line_comment(); }
|
||||
"/*" { block_comment(); }
|
||||
|
||||
"integer" { count(); return(INTEGER); }
|
||||
"float" { count(); return(FLOAT_TYPE); }
|
||||
"string" { count(); return(STRING); }
|
||||
"key" { count(); return(LLKEY); }
|
||||
"vector" { count(); return(VECTOR); }
|
||||
"quaternion" { count(); return(QUATERNION); }
|
||||
"rotation" { count(); return(QUATERNION); }
|
||||
"list" { count(); return(LIST); }
|
||||
|
||||
"default" { count(); yylval.sval = new char[strlen(yytext) + 1]; strcpy(yylval.sval, yytext); return(STATE_DEFAULT); }
|
||||
"state" { count(); return(STATE); }
|
||||
"event" { count(); return(EVENT); }
|
||||
"jump" { count(); return(JUMP); }
|
||||
"return" { count(); return(RETURN); }
|
||||
"if" { count(); return(IF); }
|
||||
"else" { count(); return(ELSE); }
|
||||
"for" { count(); return(FOR); }
|
||||
"do" { count(); return(DO); }
|
||||
"while" { count(); return(WHILE); }
|
||||
|
||||
"state_entry" { count(); return(STATE_ENTRY); }
|
||||
"state_exit" { count(); return(STATE_EXIT); }
|
||||
"touch_start" { count(); return(TOUCH_START); }
|
||||
"touch" { count(); return(TOUCH); }
|
||||
"touch_end" { count(); return(TOUCH_END); }
|
||||
"collision_start" { count(); return(COLLISION_START); }
|
||||
"collision" { count(); return(COLLISION); }
|
||||
"collision_end" { count(); return(COLLISION_END); }
|
||||
"land_collision_start" { count(); return(LAND_COLLISION_START); }
|
||||
"land_collision" { count(); return(LAND_COLLISION); }
|
||||
"land_collision_end" { count(); return(LAND_COLLISION_END); }
|
||||
"timer" { count(); return(TIMER); }
|
||||
"listen" { count(); return(CHAT); }
|
||||
"sensor" { count(); return(SENSOR); }
|
||||
"no_sensor" { count(); return(NO_SENSOR); }
|
||||
"control" { count(); return(CONTROL); }
|
||||
"print" { count(); return(PRINT); }
|
||||
"at_target" { count(); return(AT_TARGET); }
|
||||
"not_at_target" { count(); return(NOT_AT_TARGET); }
|
||||
"at_rot_target" { count(); return(AT_ROT_TARGET); }
|
||||
"not_at_rot_target" { count(); return(NOT_AT_ROT_TARGET); }
|
||||
"money" { count(); return(MONEY); }
|
||||
"email" { count(); return(EMAIL); }
|
||||
"run_time_permissions" { count(); return(RUN_TIME_PERMISSIONS); }
|
||||
"changed" { count(); return(INVENTORY); }
|
||||
"attach" { count(); return(ATTACH); }
|
||||
"dataserver" { count(); return(DATASERVER); }
|
||||
"moving_start" { count(); return(MOVING_START); }
|
||||
"moving_end" { count(); return(MOVING_END); }
|
||||
"link_message" { count(); return(LINK_MESSAGE); }
|
||||
"on_rez" { count(); return(REZ); }
|
||||
"object_rez" { count(); return(OBJECT_REZ); }
|
||||
"remote_data" { count(); return(REMOTE_DATA); }
|
||||
"http_response" { count(); return(HTTP_RESPONSE); }
|
||||
"http_request" { count(); return(HTTP_REQUEST); }
|
||||
"." { count(); return(PERIOD); }
|
||||
|
||||
|
||||
0[xX]{H}+ { count(); yylval.ival = strtoul(yytext, NULL, 0); return(INTEGER_CONSTANT); }
|
||||
{N}+ { count(); yylval.ival = strtoul(yytext, NULL, 10); return(INTEGER_CONSTANT); }
|
||||
"TRUE" { count(); yylval.ival = 1; return(INTEGER_TRUE); }
|
||||
"FALSE" { count(); yylval.ival = 0; return(INTEGER_FALSE); }
|
||||
"STATUS_PHYSICS" { count(); yylval.ival = 0x1; return(INTEGER_CONSTANT); }
|
||||
"STATUS_ROTATE_X" { count(); yylval.ival = 0x2; return(INTEGER_CONSTANT); }
|
||||
"STATUS_ROTATE_Y" { count(); yylval.ival = 0x4; return(INTEGER_CONSTANT); }
|
||||
"STATUS_ROTATE_Z" { count(); yylval.ival = 0x8; return(INTEGER_CONSTANT); }
|
||||
"STATUS_PHANTOM" { count(); yylval.ival = 0x10; return(INTEGER_CONSTANT); }
|
||||
"STATUS_SANDBOX" { count(); yylval.ival = 0x20; return(INTEGER_CONSTANT); }
|
||||
"STATUS_BLOCK_GRAB" { count(); yylval.ival = 0x40; return(INTEGER_CONSTANT); }
|
||||
"STATUS_DIE_AT_EDGE" { count(); yylval.ival = 0x80; return(INTEGER_CONSTANT); }
|
||||
"STATUS_RETURN_AT_EDGE" { count(); yylval.ival = 0x100; return(INTEGER_CONSTANT); }
|
||||
"STATUS_CAST_SHADOWS" { count(); yylval.ival = 0x200; return(INTEGER_CONSTANT); }
|
||||
|
||||
"AGENT_FLYING" { count(); yylval.ival = AGENT_FLYING; return(INTEGER_CONSTANT); }
|
||||
"AGENT_ATTACHMENTS" { count(); yylval.ival = AGENT_ATTACHMENTS; return(INTEGER_CONSTANT); }
|
||||
"AGENT_SCRIPTED" { count(); yylval.ival = AGENT_SCRIPTED; return(INTEGER_CONSTANT); }
|
||||
"AGENT_MOUSELOOK" { count(); yylval.ival = AGENT_MOUSELOOK; return(INTEGER_CONSTANT); }
|
||||
"AGENT_SITTING" { count(); yylval.ival = AGENT_SITTING; return(INTEGER_CONSTANT); }
|
||||
"AGENT_ON_OBJECT" { count(); yylval.ival = AGENT_ON_OBJECT; return(INTEGER_CONSTANT); }
|
||||
"AGENT_AWAY" { count(); yylval.ival = AGENT_AWAY; return(INTEGER_CONSTANT); }
|
||||
"AGENT_WALKING" { count(); yylval.ival = AGENT_WALKING; return(INTEGER_CONSTANT); }
|
||||
"AGENT_IN_AIR" { count(); yylval.ival = AGENT_IN_AIR; return(INTEGER_CONSTANT); }
|
||||
"AGENT_TYPING" { count(); yylval.ival = AGENT_TYPING; return(INTEGER_CONSTANT); }
|
||||
"AGENT_CROUCHING" { count(); yylval.ival = AGENT_CROUCHING; return(INTEGER_CONSTANT); }
|
||||
"AGENT_BUSY" { count(); yylval.ival = AGENT_BUSY; return(INTEGER_CONSTANT); }
|
||||
"AGENT_ALWAYS_RUN" { count(); yylval.ival = AGENT_ALWAYS_RUN; return(INTEGER_CONSTANT); }
|
||||
|
||||
"CAMERA_PITCH" { count(); yylval.ival = FOLLOWCAM_PITCH; return(INTEGER_CONSTANT); }
|
||||
"CAMERA_FOCUS_OFFSET" { count(); yylval.ival = FOLLOWCAM_FOCUS_OFFSET; return (INTEGER_CONSTANT); }
|
||||
"CAMERA_POSITION_LAG" { count(); yylval.ival = FOLLOWCAM_POSITION_LAG; return (INTEGER_CONSTANT); }
|
||||
"CAMERA_FOCUS_LAG" { count(); yylval.ival = FOLLOWCAM_FOCUS_LAG; return (INTEGER_CONSTANT); }
|
||||
"CAMERA_DISTANCE" { count(); yylval.ival = FOLLOWCAM_DISTANCE; return (INTEGER_CONSTANT); }
|
||||
"CAMERA_BEHINDNESS_ANGLE" { count(); yylval.ival = FOLLOWCAM_BEHINDNESS_ANGLE; return (INTEGER_CONSTANT); }
|
||||
"CAMERA_BEHINDNESS_LAG" { count(); yylval.ival = FOLLOWCAM_BEHINDNESS_LAG; return (INTEGER_CONSTANT); }
|
||||
"CAMERA_POSITION_THRESHOLD" { count(); yylval.ival = FOLLOWCAM_POSITION_THRESHOLD; return (INTEGER_CONSTANT); }
|
||||
"CAMERA_FOCUS_THRESHOLD" { count(); yylval.ival = FOLLOWCAM_FOCUS_THRESHOLD; return (INTEGER_CONSTANT); }
|
||||
"CAMERA_ACTIVE" { count(); yylval.ival = FOLLOWCAM_ACTIVE; return (INTEGER_CONSTANT); }
|
||||
"CAMERA_POSITION" { count(); yylval.ival = FOLLOWCAM_POSITION; return (INTEGER_CONSTANT); }
|
||||
"CAMERA_FOCUS" { count(); yylval.ival = FOLLOWCAM_FOCUS; return (INTEGER_CONSTANT); }
|
||||
"CAMERA_POSITION_LOCKED" { count(); yylval.ival = FOLLOWCAM_POSITION_LOCKED; return (INTEGER_CONSTANT); }
|
||||
"CAMERA_FOCUS_LOCKED" { count(); yylval.ival = FOLLOWCAM_FOCUS_LOCKED; return (INTEGER_CONSTANT); }
|
||||
|
||||
"ANIM_ON" { count(); yylval.ival = 0x1; return(INTEGER_CONSTANT); }
|
||||
"LOOP" { count(); yylval.ival = 0x2; return(INTEGER_CONSTANT); }
|
||||
"REVERSE" { count(); yylval.ival = 0x4; return(INTEGER_CONSTANT); }
|
||||
"PING_PONG" { count(); yylval.ival = 0x8; return(INTEGER_CONSTANT); }
|
||||
"SMOOTH" { count(); yylval.ival = 0x10; return(INTEGER_CONSTANT); }
|
||||
"ROTATE" { count(); yylval.ival = 0x20; return(INTEGER_CONSTANT); }
|
||||
"SCALE" { count(); yylval.ival = 0x40; return(INTEGER_CONSTANT); }
|
||||
|
||||
"ALL_SIDES" { count(); yylval.ival = LSL_ALL_SIDES; return(INTEGER_CONSTANT); }
|
||||
"LINK_ROOT" { count(); yylval.ival = LSL_LINK_ROOT; return(INTEGER_CONSTANT); }
|
||||
"LINK_SET" { count(); yylval.ival = LSL_LINK_SET; return(INTEGER_CONSTANT); }
|
||||
"LINK_ALL_OTHERS" { count(); yylval.ival = LSL_LINK_ALL_OTHERS; return(INTEGER_CONSTANT); }
|
||||
"LINK_ALL_CHILDREN" { count(); yylval.ival = LSL_LINK_ALL_CHILDREN; return(INTEGER_CONSTANT); }
|
||||
"LINK_THIS" { count(); yylval.ival = LSL_LINK_THIS; return(INTEGER_CONSTANT); }
|
||||
|
||||
"AGENT" { count(); yylval.ival = 0x1; return(INTEGER_CONSTANT); }
|
||||
"ACTIVE" { count(); yylval.ival = 0x2; return(INTEGER_CONSTANT); }
|
||||
"PASSIVE" { count(); yylval.ival = 0x4; return(INTEGER_CONSTANT); }
|
||||
"SCRIPTED" { count(); yylval.ival = 0x8; return(INTEGER_CONSTANT); }
|
||||
|
||||
"CONTROL_FWD" { count(); yylval.ival = AGENT_CONTROL_AT_POS; return(INTEGER_CONSTANT); }
|
||||
"CONTROL_BACK" { count(); yylval.ival = AGENT_CONTROL_AT_NEG; return(INTEGER_CONSTANT); }
|
||||
"CONTROL_LEFT" { count(); yylval.ival = AGENT_CONTROL_LEFT_POS; return(INTEGER_CONSTANT); }
|
||||
"CONTROL_RIGHT" { count(); yylval.ival = AGENT_CONTROL_LEFT_NEG; return(INTEGER_CONSTANT); }
|
||||
"CONTROL_ROT_LEFT" { count(); yylval.ival = AGENT_CONTROL_YAW_POS; return(INTEGER_CONSTANT); }
|
||||
"CONTROL_ROT_RIGHT" { count(); yylval.ival = AGENT_CONTROL_YAW_NEG; return(INTEGER_CONSTANT); }
|
||||
"CONTROL_UP" { count(); yylval.ival = AGENT_CONTROL_UP_POS; return(INTEGER_CONSTANT); }
|
||||
"CONTROL_DOWN" { count(); yylval.ival = AGENT_CONTROL_UP_NEG; return(INTEGER_CONSTANT); }
|
||||
"CONTROL_LBUTTON" { count(); yylval.ival = AGENT_CONTROL_LBUTTON_DOWN; return(INTEGER_CONSTANT); }
|
||||
"CONTROL_ML_LBUTTON" { count(); yylval.ival = AGENT_CONTROL_ML_LBUTTON_DOWN; return(INTEGER_CONSTANT); }
|
||||
|
||||
"PERMISSION_DEBIT" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_DEBIT]; return(INTEGER_CONSTANT); }
|
||||
"PERMISSION_TAKE_CONTROLS" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_TAKE_CONTROLS]; return(INTEGER_CONSTANT); }
|
||||
"PERMISSION_REMAP_CONTROLS" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_REMAP_CONTROLS]; return(INTEGER_CONSTANT); }
|
||||
"PERMISSION_TRIGGER_ANIMATION" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_TRIGGER_ANIMATION]; return(INTEGER_CONSTANT); }
|
||||
"PERMISSION_ATTACH" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_ATTACH]; return(INTEGER_CONSTANT); }
|
||||
"PERMISSION_RELEASE_OWNERSHIP" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_RELEASE_OWNERSHIP]; return(INTEGER_CONSTANT); }
|
||||
"PERMISSION_CHANGE_LINKS" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_CHANGE_LINKS]; return(INTEGER_CONSTANT); }
|
||||
"PERMISSION_CHANGE_JOINTS" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_CHANGE_JOINTS]; return(INTEGER_CONSTANT); }
|
||||
"PERMISSION_CHANGE_PERMISSIONS" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_CHANGE_PERMISSIONS]; return(INTEGER_CONSTANT); }
|
||||
"PERMISSION_TRACK_CAMERA" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_TRACK_CAMERA]; return(INTEGER_CONSTANT); }
|
||||
"PERMISSION_CONTROL_CAMERA" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_CONTROL_CAMERA]; return(INTEGER_CONSTANT); }
|
||||
|
||||
"INVENTORY_TEXTURE" { count(); yylval.ival = LLAssetType::AT_TEXTURE; return(INTEGER_CONSTANT); }
|
||||
"INVENTORY_SOUND" { count(); yylval.ival = LLAssetType::AT_SOUND; return(INTEGER_CONSTANT); }
|
||||
"INVENTORY_OBJECT" { count(); yylval.ival = LLAssetType::AT_OBJECT; return(INTEGER_CONSTANT); }
|
||||
"INVENTORY_SCRIPT" { count(); yylval.ival = LLAssetType::AT_LSL_TEXT; return(INTEGER_CONSTANT); }
|
||||
"INVENTORY_LANDMARK" { count(); yylval.ival = LLAssetType::AT_LANDMARK; return(INTEGER_CONSTANT); }
|
||||
"INVENTORY_CLOTHING" { count(); yylval.ival = LLAssetType::AT_CLOTHING; return(INTEGER_CONSTANT); }
|
||||
"INVENTORY_NOTECARD" { count(); yylval.ival = LLAssetType::AT_NOTECARD; return(INTEGER_CONSTANT); }
|
||||
"INVENTORY_BODYPART" { count(); yylval.ival = LLAssetType::AT_BODYPART; return(INTEGER_CONSTANT); }
|
||||
"INVENTORY_ANIMATION" { count(); yylval.ival = LLAssetType::AT_ANIMATION; return(INTEGER_CONSTANT); }
|
||||
"INVENTORY_GESTURE" { count(); yylval.ival = LLAssetType::AT_GESTURE; return(INTEGER_CONSTANT); }
|
||||
"INVENTORY_ALL" { count(); yylval.ival = LLAssetType::AT_NONE; return(INTEGER_CONSTANT); }
|
||||
"INVENTORY_NONE" { count(); yylval.ival = LLAssetType::AT_NONE; return(INTEGER_CONSTANT); }
|
||||
|
||||
"CHANGED_INVENTORY" { count(); yylval.ival = CHANGED_INVENTORY; return(INTEGER_CONSTANT); }
|
||||
"CHANGED_COLOR" { count(); yylval.ival = CHANGED_COLOR; return(INTEGER_CONSTANT); }
|
||||
"CHANGED_SHAPE" { count(); yylval.ival = CHANGED_SHAPE; return(INTEGER_CONSTANT); }
|
||||
"CHANGED_SCALE" { count(); yylval.ival = CHANGED_SCALE; return(INTEGER_CONSTANT); }
|
||||
"CHANGED_TEXTURE" { count(); yylval.ival = CHANGED_TEXTURE; return(INTEGER_CONSTANT); }
|
||||
"CHANGED_LINK" { count(); yylval.ival = CHANGED_LINK; return(INTEGER_CONSTANT); }
|
||||
"CHANGED_ALLOWED_DROP" { count(); yylval.ival = CHANGED_ALLOWED_DROP; return(INTEGER_CONSTANT); }
|
||||
"CHANGED_OWNER" { count(); yylval.ival = CHANGED_OWNER; return(INTEGER_CONSTANT); }
|
||||
"CHANGED_REGION" { count(); yylval.ival = CHANGED_REGION; return(INTEGER_CONSTANT); }
|
||||
"CHANGED_TELEPORT" { count(); yylval.ival = CHANGED_TELEPORT; return(INTEGER_CONSTANT); }
|
||||
"CHANGED_REGION_START" { count(); yylval.ival = CHANGED_REGION_START; return(INTEGER_CONSTANT); }
|
||||
|
||||
"OBJECT_UNKNOWN_DETAIL" { count(); yylval.ival = OBJECT_UNKNOWN_DETAIL; return(INTEGER_CONSTANT); }
|
||||
"OBJECT_NAME" { count(); yylval.ival = OBJECT_NAME; return(INTEGER_CONSTANT); }
|
||||
"OBJECT_DESC" { count(); yylval.ival = OBJECT_DESC; return(INTEGER_CONSTANT); }
|
||||
"OBJECT_POS" { count(); yylval.ival = OBJECT_POS; return(INTEGER_CONSTANT); }
|
||||
"OBJECT_ROT" { count(); yylval.ival = OBJECT_ROT; return(INTEGER_CONSTANT); }
|
||||
"OBJECT_VELOCITY" { count(); yylval.ival = OBJECT_VELOCITY; return(INTEGER_CONSTANT); }
|
||||
"OBJECT_OWNER" { count(); yylval.ival = OBJECT_OWNER; return(INTEGER_CONSTANT); }
|
||||
"OBJECT_GROUP" { count(); yylval.ival = OBJECT_GROUP; return(INTEGER_CONSTANT); }
|
||||
"OBJECT_CREATOR" { count(); yylval.ival = OBJECT_CREATOR; return(INTEGER_CONSTANT); }
|
||||
|
||||
"TYPE_INTEGER" { count(); yylval.ival = LST_INTEGER; return(INTEGER_CONSTANT); }
|
||||
"TYPE_FLOAT" { count(); yylval.ival = LST_FLOATINGPOINT; return(INTEGER_CONSTANT); }
|
||||
"TYPE_STRING" { count(); yylval.ival = LST_STRING; return(INTEGER_CONSTANT); }
|
||||
"TYPE_KEY" { count(); yylval.ival = LST_KEY; return(INTEGER_CONSTANT); }
|
||||
"TYPE_VECTOR" { count(); yylval.ival = LST_VECTOR; return(INTEGER_CONSTANT); }
|
||||
"TYPE_ROTATION" { count(); yylval.ival = LST_QUATERNION; return(INTEGER_CONSTANT); }
|
||||
"TYPE_INVALID" { count(); yylval.ival = LST_NULL; return(INTEGER_CONSTANT); }
|
||||
|
||||
"NULL_KEY" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, "00000000-0000-0000-0000-000000000000"); return(STRING_CONSTANT); }
|
||||
"EOF" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, "\n\n\n"); return(STRING_CONSTANT); }
|
||||
"URL_REQUEST_GRANTED" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, URL_REQUEST_GRANTED); return(STRING_CONSTANT); }
|
||||
"URL_REQUEST_DENIED" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, URL_REQUEST_DENIED); return(STRING_CONSTANT); }
|
||||
|
||||
"PI" { count(); yylval.fval = F_PI; return(FP_CONSTANT); }
|
||||
"TWO_PI" { count(); yylval.fval = F_TWO_PI; return(FP_CONSTANT); }
|
||||
"PI_BY_TWO" { count(); yylval.fval = F_PI_BY_TWO; return(FP_CONSTANT); }
|
||||
"DEG_TO_RAD" { count(); yylval.fval = DEG_TO_RAD; return(FP_CONSTANT); }
|
||||
"RAD_TO_DEG" { count(); yylval.fval = RAD_TO_DEG; return(FP_CONSTANT); }
|
||||
"SQRT2" { count(); yylval.fval = F_SQRT2; return(FP_CONSTANT); }
|
||||
|
||||
"DEBUG_CHANNEL" { count(); yylval.ival = CHAT_CHANNEL_DEBUG; return(INTEGER_CONSTANT); }
|
||||
"PUBLIC_CHANNEL" { count(); yylval.ival = 0; return(INTEGER_CONSTANT); }
|
||||
|
||||
"ZERO_VECTOR" { count(); return(ZERO_VECTOR); }
|
||||
"ZERO_ROTATION" { count(); return(ZERO_ROTATION); }
|
||||
|
||||
"ATTACH_CHEST" { count(); yylval.ival = 1; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_HEAD" { count(); yylval.ival = 2; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_LSHOULDER" { count(); yylval.ival = 3; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_RSHOULDER" { count(); yylval.ival = 4; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_LHAND" { count(); yylval.ival = 5; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_RHAND" { count(); yylval.ival = 6; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_LFOOT" { count(); yylval.ival = 7; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_RFOOT" { count(); yylval.ival = 8; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_BACK" { count(); yylval.ival = 9; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_PELVIS" { count(); yylval.ival = 10; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_MOUTH" { count(); yylval.ival = 11; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_CHIN" { count(); yylval.ival = 12; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_LEAR" { count(); yylval.ival = 13; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_REAR" { count(); yylval.ival = 14; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_LEYE" { count(); yylval.ival = 15; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_REYE" { count(); yylval.ival = 16; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_NOSE" { count(); yylval.ival = 17; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_RUARM" { count(); yylval.ival = 18; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_RLARM" { count(); yylval.ival = 19; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_LUARM" { count(); yylval.ival = 20; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_LLARM" { count(); yylval.ival = 21; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_RHIP" { count(); yylval.ival = 22; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_RULEG" { count(); yylval.ival = 23; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_RLLEG" { count(); yylval.ival = 24; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_LHIP" { count(); yylval.ival = 25; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_LULEG" { count(); yylval.ival = 26; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_LLLEG" { count(); yylval.ival = 27; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_BELLY" { count(); yylval.ival = 28; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_RPEC" { count(); yylval.ival = 29; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_LPEC" { count(); yylval.ival = 30; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_HUD_CENTER_2" { count(); yylval.ival = 31; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_HUD_TOP_RIGHT" { count(); yylval.ival = 32; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_HUD_TOP_CENTER" { count(); yylval.ival = 33; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_HUD_TOP_LEFT" { count(); yylval.ival = 34; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_HUD_CENTER_1" { count(); yylval.ival = 35; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_HUD_BOTTOM_LEFT" { count(); yylval.ival = 36; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_HUD_BOTTOM" { count(); yylval.ival = 37; return(INTEGER_CONSTANT); }
|
||||
"ATTACH_HUD_BOTTOM_RIGHT" { count(); yylval.ival = 38; return(INTEGER_CONSTANT); }
|
||||
|
||||
"LAND_LEVEL" { count(); yylval.ival = E_LANDBRUSH_LEVEL; return(INTEGER_CONSTANT); }
|
||||
"LAND_RAISE" { count(); yylval.ival = E_LANDBRUSH_RAISE; return(INTEGER_CONSTANT); }
|
||||
"LAND_LOWER" { count(); yylval.ival = E_LANDBRUSH_LOWER; return(INTEGER_CONSTANT); }
|
||||
"LAND_SMOOTH" { count(); yylval.ival = E_LANDBRUSH_SMOOTH; return(INTEGER_CONSTANT); }
|
||||
"LAND_NOISE" { count(); yylval.ival = E_LANDBRUSH_NOISE; return(INTEGER_CONSTANT); }
|
||||
"LAND_REVERT" { count(); yylval.ival = E_LANDBRUSH_REVERT; return(INTEGER_CONSTANT); }
|
||||
|
||||
"LAND_SMALL_BRUSH" { count(); yylval.ival = 1; return(INTEGER_CONSTANT); }
|
||||
"LAND_MEDIUM_BRUSH" { count(); yylval.ival = 2; return(INTEGER_CONSTANT); }
|
||||
"LAND_LARGE_BRUSH" { count(); yylval.ival = 3; return(INTEGER_CONSTANT); }
|
||||
|
||||
"DATA_ONLINE" { count(); yylval.ival = 1; return(INTEGER_CONSTANT); }
|
||||
"DATA_NAME" { count(); yylval.ival = 2; return(INTEGER_CONSTANT); }
|
||||
"DATA_BORN" { count(); yylval.ival = 3; return(INTEGER_CONSTANT); }
|
||||
"DATA_RATING" { count(); yylval.ival = 4; return(INTEGER_CONSTANT); }
|
||||
"DATA_SIM_POS" { count(); yylval.ival = 5; return(INTEGER_CONSTANT); }
|
||||
"DATA_SIM_STATUS" { count(); yylval.ival = 6; return(INTEGER_CONSTANT); }
|
||||
"DATA_SIM_RATING" { count(); yylval.ival = 7; return(INTEGER_CONSTANT); }
|
||||
"DATA_PAYINFO" { count(); yylval.ival = 8; return(INTEGER_CONSTANT); }
|
||||
|
||||
"PAYMENT_INFO_ON_FILE" { count(); yylval.ival = 1; return(INTEGER_CONSTANT); }
|
||||
"PAYMENT_INFO_USED" { count(); yylval.ival = 2; return(INTEGER_CONSTANT); }
|
||||
|
||||
"REMOTE_DATA_CHANNEL" { count(); yylval.ival = LSL_REMOTE_DATA_CHANNEL; return(INTEGER_CONSTANT); }
|
||||
"REMOTE_DATA_REQUEST" { count(); yylval.ival = LSL_REMOTE_DATA_REQUEST; return(INTEGER_CONSTANT); }
|
||||
"REMOTE_DATA_REPLY" { count(); yylval.ival = LSL_REMOTE_DATA_REPLY; return(INTEGER_CONSTANT); }
|
||||
|
||||
|
||||
"PSYS_PART_FLAGS" { count(); yylval.ival = LLPS_PART_FLAGS; return(INTEGER_CONSTANT); }
|
||||
"PSYS_PART_START_COLOR" { count(); yylval.ival = LLPS_PART_START_COLOR; return (INTEGER_CONSTANT); }
|
||||
"PSYS_PART_START_ALPHA" { count(); yylval.ival = LLPS_PART_START_ALPHA; return (INTEGER_CONSTANT); }
|
||||
"PSYS_PART_START_SCALE" { count(); yylval.ival = LLPS_PART_START_SCALE; return (INTEGER_CONSTANT); }
|
||||
"PSYS_PART_END_COLOR" { count(); yylval.ival = LLPS_PART_END_COLOR; return (INTEGER_CONSTANT); }
|
||||
"PSYS_PART_END_ALPHA" { count(); yylval.ival = LLPS_PART_END_ALPHA; return (INTEGER_CONSTANT); }
|
||||
"PSYS_PART_END_SCALE" { count(); yylval.ival = LLPS_PART_END_SCALE; return (INTEGER_CONSTANT); }
|
||||
"PSYS_PART_MAX_AGE" { count(); yylval.ival = LLPS_PART_MAX_AGE; return (INTEGER_CONSTANT); }
|
||||
|
||||
|
||||
"PSYS_PART_WIND_MASK" { count(); yylval.ival = LLPartData::LL_PART_WIND_MASK; return(INTEGER_CONSTANT); }
|
||||
"PSYS_PART_INTERP_COLOR_MASK" { count(); yylval.ival = LLPartData::LL_PART_INTERP_COLOR_MASK; return(INTEGER_CONSTANT); }
|
||||
"PSYS_PART_INTERP_SCALE_MASK" { count(); yylval.ival = LLPartData::LL_PART_INTERP_SCALE_MASK; return(INTEGER_CONSTANT); }
|
||||
"PSYS_PART_BOUNCE_MASK" { count(); yylval.ival = LLPartData::LL_PART_BOUNCE_MASK; return(INTEGER_CONSTANT); }
|
||||
"PSYS_PART_FOLLOW_SRC_MASK" { count(); yylval.ival = LLPartData::LL_PART_FOLLOW_SRC_MASK; return(INTEGER_CONSTANT); }
|
||||
"PSYS_PART_FOLLOW_VELOCITY_MASK" { count(); yylval.ival = LLPartData::LL_PART_FOLLOW_VELOCITY_MASK; return(INTEGER_CONSTANT); }
|
||||
"PSYS_PART_TARGET_POS_MASK" { count(); yylval.ival = LLPartData::LL_PART_TARGET_POS_MASK; return(INTEGER_CONSTANT); }
|
||||
"PSYS_PART_EMISSIVE_MASK" { count(); yylval.ival = LLPartData::LL_PART_EMISSIVE_MASK; return(INTEGER_CONSTANT); }
|
||||
"PSYS_PART_TARGET_LINEAR_MASK" { count(); yylval.ival = LLPartData::LL_PART_TARGET_LINEAR_MASK; return(INTEGER_CONSTANT); }
|
||||
|
||||
|
||||
"PSYS_SRC_MAX_AGE" { count(); yylval.ival = LLPS_SRC_MAX_AGE; return(INTEGER_CONSTANT); }
|
||||
"PSYS_SRC_PATTERN" { count(); yylval.ival = LLPS_SRC_PATTERN; return(INTEGER_CONSTANT); }
|
||||
"PSYS_SRC_INNERANGLE" { count(); yylval.ival = LLPS_SRC_INNERANGLE; return(INTEGER_CONSTANT); }
|
||||
"PSYS_SRC_OUTERANGLE" { count(); yylval.ival = LLPS_SRC_OUTERANGLE; return(INTEGER_CONSTANT); }
|
||||
"PSYS_SRC_ANGLE_BEGIN" { count(); yylval.ival = LLPS_SRC_ANGLE_BEGIN; return(INTEGER_CONSTANT); }
|
||||
"PSYS_SRC_ANGLE_END" { count(); yylval.ival = LLPS_SRC_ANGLE_END; return(INTEGER_CONSTANT); }
|
||||
"PSYS_SRC_BURST_RATE" { count(); yylval.ival = LLPS_SRC_BURST_RATE; return(INTEGER_CONSTANT); }
|
||||
"PSYS_SRC_BURST_PART_COUNT" { count(); yylval.ival = LLPS_SRC_BURST_PART_COUNT; return(INTEGER_CONSTANT); }
|
||||
"PSYS_SRC_BURST_RADIUS" { count(); yylval.ival = LLPS_SRC_BURST_RADIUS; return(INTEGER_CONSTANT); }
|
||||
"PSYS_SRC_BURST_SPEED_MIN" { count(); yylval.ival = LLPS_SRC_BURST_SPEED_MIN; return(INTEGER_CONSTANT); }
|
||||
"PSYS_SRC_BURST_SPEED_MAX" { count(); yylval.ival = LLPS_SRC_BURST_SPEED_MAX; return(INTEGER_CONSTANT); }
|
||||
"PSYS_SRC_ACCEL" { count(); yylval.ival = LLPS_SRC_ACCEL; return(INTEGER_CONSTANT); }
|
||||
"PSYS_SRC_TEXTURE" { count(); yylval.ival = LLPS_SRC_TEXTURE; return(INTEGER_CONSTANT); }
|
||||
"PSYS_SRC_TARGET_KEY" { count(); yylval.ival = LLPS_SRC_TARGET_UUID; return(INTEGER_CONSTANT); }
|
||||
"PSYS_SRC_OMEGA" { count(); yylval.ival = LLPS_SRC_OMEGA; return(INTEGER_CONSTANT); }
|
||||
|
||||
"PSYS_SRC_OBJ_REL_MASK" { count(); yylval.ival = LLPartSysData::LL_PART_SRC_OBJ_REL_MASK; return(INTEGER_CONSTANT); }
|
||||
|
||||
"PSYS_SRC_PATTERN_DROP" { count(); yylval.ival = LLPartSysData::LL_PART_SRC_PATTERN_DROP; return(INTEGER_CONSTANT); }
|
||||
"PSYS_SRC_PATTERN_EXPLODE" { count(); yylval.ival = LLPartSysData::LL_PART_SRC_PATTERN_EXPLODE; return(INTEGER_CONSTANT); }
|
||||
"PSYS_SRC_PATTERN_ANGLE" { count(); yylval.ival = LLPartSysData::LL_PART_SRC_PATTERN_ANGLE; return(INTEGER_CONSTANT); }
|
||||
"PSYS_SRC_PATTERN_ANGLE_CONE" { count(); yylval.ival = LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE; return(INTEGER_CONSTANT); }
|
||||
"PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY" { count(); yylval.ival = LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE_EMPTY; return(INTEGER_CONSTANT); }
|
||||
|
||||
|
||||
"VEHICLE_TYPE_NONE" { count(); yylval.ival = VEHICLE_TYPE_NONE; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_TYPE_SLED" { count(); yylval.ival = VEHICLE_TYPE_SLED; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_TYPE_CAR" { count(); yylval.ival = VEHICLE_TYPE_CAR; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_TYPE_BOAT" { count(); yylval.ival = VEHICLE_TYPE_BOAT; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_TYPE_AIRPLANE" { count(); yylval.ival = VEHICLE_TYPE_AIRPLANE; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_TYPE_BALLOON" { count(); yylval.ival = VEHICLE_TYPE_BALLOON; return(INTEGER_CONSTANT); }
|
||||
|
||||
"VEHICLE_REFERENCE_FRAME" { count(); yylval.ival = VEHICLE_REFERENCE_FRAME; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_LINEAR_FRICTION_TIMESCALE" { count(); yylval.ival = VEHICLE_LINEAR_FRICTION_TIMESCALE; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_ANGULAR_FRICTION_TIMESCALE" { count(); yylval.ival = VEHICLE_ANGULAR_FRICTION_TIMESCALE; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_LINEAR_MOTOR_DIRECTION" { count(); yylval.ival = VEHICLE_LINEAR_MOTOR_DIRECTION; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_ANGULAR_MOTOR_DIRECTION" { count(); yylval.ival = VEHICLE_ANGULAR_MOTOR_DIRECTION; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_LINEAR_MOTOR_OFFSET" { count(); yylval.ival = VEHICLE_LINEAR_MOTOR_OFFSET; return(INTEGER_CONSTANT); }
|
||||
|
||||
|
||||
|
||||
"VEHICLE_HOVER_HEIGHT" { count(); yylval.ival = VEHICLE_HOVER_HEIGHT; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_HOVER_EFFICIENCY" { count(); yylval.ival = VEHICLE_HOVER_EFFICIENCY; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_HOVER_TIMESCALE" { count(); yylval.ival = VEHICLE_HOVER_TIMESCALE; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_BUOYANCY" { count(); yylval.ival = VEHICLE_BUOYANCY; return(INTEGER_CONSTANT); }
|
||||
|
||||
"VEHICLE_LINEAR_DEFLECTION_EFFICIENCY" { count(); yylval.ival = VEHICLE_LINEAR_DEFLECTION_EFFICIENCY; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_LINEAR_DEFLECTION_TIMESCALE" { count(); yylval.ival = VEHICLE_LINEAR_DEFLECTION_TIMESCALE; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_LINEAR_MOTOR_TIMESCALE" { count(); yylval.ival = VEHICLE_LINEAR_MOTOR_TIMESCALE; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE" { count(); yylval.ival = VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE; return(INTEGER_CONSTANT); }
|
||||
|
||||
"VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY" { count(); yylval.ival = VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_ANGULAR_DEFLECTION_TIMESCALE" { count(); yylval.ival = VEHICLE_ANGULAR_DEFLECTION_TIMESCALE; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_ANGULAR_MOTOR_TIMESCALE" { count(); yylval.ival = VEHICLE_ANGULAR_MOTOR_TIMESCALE; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE" { count(); yylval.ival = VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE; return(INTEGER_CONSTANT); }
|
||||
|
||||
"VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY" { count(); yylval.ival = VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_VERTICAL_ATTRACTION_TIMESCALE" { count(); yylval.ival = VEHICLE_VERTICAL_ATTRACTION_TIMESCALE; return(INTEGER_CONSTANT); }
|
||||
|
||||
"VEHICLE_BANKING_EFFICIENCY" { count(); yylval.ival = VEHICLE_BANKING_EFFICIENCY; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_BANKING_MIX" { count(); yylval.ival = VEHICLE_BANKING_MIX; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_BANKING_TIMESCALE" { count(); yylval.ival = VEHICLE_BANKING_TIMESCALE; return(INTEGER_CONSTANT); }
|
||||
|
||||
"VEHICLE_FLAG_NO_FLY_UP" { count(); yylval.ival = VEHICLE_FLAG_NO_DEFLECTION_UP; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_FLAG_NO_DEFLECTION_UP" { count(); yylval.ival = VEHICLE_FLAG_NO_DEFLECTION_UP; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_FLAG_LIMIT_ROLL_ONLY" { count(); yylval.ival = VEHICLE_FLAG_LIMIT_ROLL_ONLY; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_FLAG_HOVER_WATER_ONLY" { count(); yylval.ival = VEHICLE_FLAG_HOVER_WATER_ONLY; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_FLAG_HOVER_TERRAIN_ONLY" { count(); yylval.ival = VEHICLE_FLAG_HOVER_TERRAIN_ONLY; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT" { count(); yylval.ival = VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_FLAG_HOVER_UP_ONLY" { count(); yylval.ival = VEHICLE_FLAG_HOVER_UP_ONLY; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_FLAG_LIMIT_MOTOR_UP" { count(); yylval.ival = VEHICLE_FLAG_LIMIT_MOTOR_UP; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_FLAG_MOUSELOOK_STEER" { count(); yylval.ival = VEHICLE_FLAG_MOUSELOOK_STEER; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_FLAG_MOUSELOOK_BANK" { count(); yylval.ival = VEHICLE_FLAG_MOUSELOOK_BANK; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_FLAG_CAMERA_DECOUPLED" { count(); yylval.ival = VEHICLE_FLAG_CAMERA_DECOUPLED; return(INTEGER_CONSTANT); }
|
||||
|
||||
|
||||
|
||||
"PRIM_TYPE" { count(); yylval.ival = LSL_PRIM_TYPE; return(INTEGER_CONSTANT); }
|
||||
"PRIM_MATERIAL" { count(); yylval.ival = LSL_PRIM_MATERIAL; return(INTEGER_CONSTANT); }
|
||||
"PRIM_PHYSICS" { count(); yylval.ival = LSL_PRIM_PHYSICS; return(INTEGER_CONSTANT); }
|
||||
"PRIM_FLEXIBLE" { count(); yylval.ival = LSL_PRIM_FLEXIBLE; return(INTEGER_CONSTANT); }
|
||||
"PRIM_POINT_LIGHT" { count(); yylval.ival = LSL_PRIM_POINT_LIGHT; return(INTEGER_CONSTANT); }
|
||||
"PRIM_TEMP_ON_REZ" { count(); yylval.ival = LSL_PRIM_TEMP_ON_REZ; return(INTEGER_CONSTANT); }
|
||||
"PRIM_PHANTOM" { count(); yylval.ival = LSL_PRIM_PHANTOM; return(INTEGER_CONSTANT); }
|
||||
"PRIM_CAST_SHADOWS" { count(); yylval.ival = LSL_PRIM_CAST_SHADOWS; return(INTEGER_CONSTANT); }
|
||||
"PRIM_POSITION" { count(); yylval.ival = LSL_PRIM_POSITION; return(INTEGER_CONSTANT); }
|
||||
"PRIM_SIZE" { count(); yylval.ival = LSL_PRIM_SIZE; return(INTEGER_CONSTANT); }
|
||||
"PRIM_ROTATION" { count(); yylval.ival = LSL_PRIM_ROTATION; return(INTEGER_CONSTANT); }
|
||||
"PRIM_TEXTURE" { count(); yylval.ival = LSL_PRIM_TEXTURE; return(INTEGER_CONSTANT); }
|
||||
"PRIM_COLOR" { count(); yylval.ival = LSL_PRIM_COLOR; return(INTEGER_CONSTANT); }
|
||||
"PRIM_BUMP_SHINY" { count(); yylval.ival = LSL_PRIM_BUMP_SHINY; return(INTEGER_CONSTANT); }
|
||||
"PRIM_FULLBRIGHT" { count(); yylval.ival = LSL_PRIM_FULLBRIGHT; return(INTEGER_CONSTANT); }
|
||||
"PRIM_TEXGEN" { count(); yylval.ival = LSL_PRIM_TEXGEN; return(INTEGER_CONSTANT); }
|
||||
"PRIM_GLOW" { count(); yylval.ival = LSL_PRIM_GLOW; return(INTEGER_CONSTANT); }
|
||||
|
||||
"PRIM_TYPE_BOX" { count(); yylval.ival = LSL_PRIM_TYPE_BOX; return(INTEGER_CONSTANT); }
|
||||
"PRIM_TYPE_CYLINDER" { count(); yylval.ival = LSL_PRIM_TYPE_CYLINDER; return(INTEGER_CONSTANT); }
|
||||
"PRIM_TYPE_PRISM" { count(); yylval.ival = LSL_PRIM_TYPE_PRISM; return(INTEGER_CONSTANT); }
|
||||
"PRIM_TYPE_SPHERE" { count(); yylval.ival = LSL_PRIM_TYPE_SPHERE; return(INTEGER_CONSTANT); }
|
||||
"PRIM_TYPE_TORUS" { count(); yylval.ival = LSL_PRIM_TYPE_TORUS; return(INTEGER_CONSTANT); }
|
||||
"PRIM_TYPE_TUBE" { count(); yylval.ival = LSL_PRIM_TYPE_TUBE; return(INTEGER_CONSTANT); }
|
||||
"PRIM_TYPE_RING" { count(); yylval.ival = LSL_PRIM_TYPE_RING; return(INTEGER_CONSTANT); }
|
||||
"PRIM_TYPE_SCULPT" { count(); yylval.ival = LSL_PRIM_TYPE_SCULPT; return(INTEGER_CONSTANT); }
|
||||
|
||||
"PRIM_HOLE_DEFAULT" { count(); yylval.ival = LSL_PRIM_HOLE_DEFAULT; return(INTEGER_CONSTANT); }
|
||||
"PRIM_HOLE_CIRCLE" { count(); yylval.ival = LSL_PRIM_HOLE_CIRCLE; return(INTEGER_CONSTANT); }
|
||||
"PRIM_HOLE_SQUARE" { count(); yylval.ival = LSL_PRIM_HOLE_SQUARE; return(INTEGER_CONSTANT); }
|
||||
"PRIM_HOLE_TRIANGLE" { count(); yylval.ival = LSL_PRIM_HOLE_TRIANGLE; return(INTEGER_CONSTANT); }
|
||||
|
||||
"PRIM_MATERIAL_STONE" { count(); yylval.ival = LSL_PRIM_MATERIAL_STONE; return(INTEGER_CONSTANT); }
|
||||
"PRIM_MATERIAL_METAL" { count(); yylval.ival = LSL_PRIM_MATERIAL_METAL; return(INTEGER_CONSTANT); }
|
||||
"PRIM_MATERIAL_GLASS" { count(); yylval.ival = LSL_PRIM_MATERIAL_GLASS; return(INTEGER_CONSTANT); }
|
||||
"PRIM_MATERIAL_WOOD" { count(); yylval.ival = LSL_PRIM_MATERIAL_WOOD; return(INTEGER_CONSTANT); }
|
||||
"PRIM_MATERIAL_FLESH" { count(); yylval.ival = LSL_PRIM_MATERIAL_FLESH; return(INTEGER_CONSTANT); }
|
||||
"PRIM_MATERIAL_PLASTIC" { count(); yylval.ival = LSL_PRIM_MATERIAL_PLASTIC; return(INTEGER_CONSTANT); }
|
||||
"PRIM_MATERIAL_RUBBER" { count(); yylval.ival = LSL_PRIM_MATERIAL_RUBBER; return(INTEGER_CONSTANT); }
|
||||
"PRIM_MATERIAL_LIGHT" { count(); yylval.ival = LSL_PRIM_MATERIAL_LIGHT; return(INTEGER_CONSTANT); }
|
||||
|
||||
"PRIM_SHINY_NONE" { count(); yylval.ival = LSL_PRIM_SHINY_NONE; return(INTEGER_CONSTANT); }
|
||||
"PRIM_SHINY_LOW" { count(); yylval.ival = LSL_PRIM_SHINY_LOW; return(INTEGER_CONSTANT); }
|
||||
"PRIM_SHINY_MEDIUM" { count(); yylval.ival = LSL_PRIM_SHINY_MEDIUM; return(INTEGER_CONSTANT); }
|
||||
"PRIM_SHINY_HIGH" { count(); yylval.ival = LSL_PRIM_SHINY_HIGH; return(INTEGER_CONSTANT); }
|
||||
|
||||
"PRIM_BUMP_NONE" { count(); yylval.ival = LSL_PRIM_BUMP_NONE; return(INTEGER_CONSTANT); }
|
||||
"PRIM_BUMP_BRIGHT" { count(); yylval.ival = LSL_PRIM_BUMP_BRIGHT; return(INTEGER_CONSTANT); }
|
||||
"PRIM_BUMP_DARK" { count(); yylval.ival = LSL_PRIM_BUMP_DARK; return(INTEGER_CONSTANT); }
|
||||
"PRIM_BUMP_WOOD" { count(); yylval.ival = LSL_PRIM_BUMP_WOOD; return(INTEGER_CONSTANT); }
|
||||
"PRIM_BUMP_BARK" { count(); yylval.ival = LSL_PRIM_BUMP_BARK; return(INTEGER_CONSTANT); }
|
||||
"PRIM_BUMP_BRICKS" { count(); yylval.ival = LSL_PRIM_BUMP_BRICKS; return(INTEGER_CONSTANT); }
|
||||
"PRIM_BUMP_CHECKER" { count(); yylval.ival = LSL_PRIM_BUMP_CHECKER; return(INTEGER_CONSTANT); }
|
||||
"PRIM_BUMP_CONCRETE" { count(); yylval.ival = LSL_PRIM_BUMP_CONCRETE; return(INTEGER_CONSTANT); }
|
||||
"PRIM_BUMP_TILE" { count(); yylval.ival = LSL_PRIM_BUMP_TILE; return(INTEGER_CONSTANT); }
|
||||
"PRIM_BUMP_STONE" { count(); yylval.ival = LSL_PRIM_BUMP_STONE; return(INTEGER_CONSTANT); }
|
||||
"PRIM_BUMP_DISKS" { count(); yylval.ival = LSL_PRIM_BUMP_DISKS; return(INTEGER_CONSTANT); }
|
||||
"PRIM_BUMP_GRAVEL" { count(); yylval.ival = LSL_PRIM_BUMP_GRAVEL; return(INTEGER_CONSTANT); }
|
||||
"PRIM_BUMP_BLOBS" { count(); yylval.ival = LSL_PRIM_BUMP_BLOBS; return(INTEGER_CONSTANT); }
|
||||
"PRIM_BUMP_SIDING" { count(); yylval.ival = LSL_PRIM_BUMP_SIDING; return(INTEGER_CONSTANT); }
|
||||
"PRIM_BUMP_LARGETILE" { count(); yylval.ival = LSL_PRIM_BUMP_LARGETILE; return(INTEGER_CONSTANT); }
|
||||
"PRIM_BUMP_STUCCO" { count(); yylval.ival = LSL_PRIM_BUMP_STUCCO; return(INTEGER_CONSTANT); }
|
||||
"PRIM_BUMP_SUCTION" { count(); yylval.ival = LSL_PRIM_BUMP_SUCTION; return(INTEGER_CONSTANT); }
|
||||
"PRIM_BUMP_WEAVE" { count(); yylval.ival = LSL_PRIM_BUMP_WEAVE; return(INTEGER_CONSTANT); }
|
||||
|
||||
"PRIM_TEXGEN_DEFAULT" { count(); yylval.ival = LSL_PRIM_TEXGEN_DEFAULT; return(INTEGER_CONSTANT); }
|
||||
"PRIM_TEXGEN_PLANAR" { count(); yylval.ival = LSL_PRIM_TEXGEN_PLANAR; return(INTEGER_CONSTANT); }
|
||||
|
||||
"PRIM_SCULPT_TYPE_SPHERE" { count(); yylval.ival = LSL_PRIM_SCULPT_TYPE_SPHERE; return(INTEGER_CONSTANT); }
|
||||
"PRIM_SCULPT_TYPE_TORUS" { count(); yylval.ival = LSL_PRIM_SCULPT_TYPE_TORUS; return(INTEGER_CONSTANT); }
|
||||
"PRIM_SCULPT_TYPE_PLANE" { count(); yylval.ival = LSL_PRIM_SCULPT_TYPE_PLANE; return(INTEGER_CONSTANT); }
|
||||
"PRIM_SCULPT_TYPE_CYLINDER" { count(); yylval.ival = LSL_PRIM_SCULPT_TYPE_CYLINDER; return(INTEGER_CONSTANT); }
|
||||
"PRIM_SCULPT_TYPE_MASK" { count(); yylval.ival = LSL_PRIM_SCULPT_TYPE_MASK; return(INTEGER_CONSTANT); }
|
||||
"PRIM_SCULPT_FLAG_MIRROR" { count(); yylval.ival = LSL_PRIM_SCULPT_FLAG_MIRROR; return(INTEGER_CONSTANT); }
|
||||
"PRIM_SCULPT_FLAG_INVERT" { count(); yylval.ival = LSL_PRIM_SCULPT_FLAG_INVERT; return(INTEGER_CONSTANT); }
|
||||
|
||||
"MASK_BASE" { count(); yylval.ival = 0; return(INTEGER_CONSTANT); }
|
||||
"MASK_OWNER" { count(); yylval.ival = 1; return(INTEGER_CONSTANT); }
|
||||
"MASK_GROUP" { count(); yylval.ival = 2; return(INTEGER_CONSTANT); }
|
||||
"MASK_EVERYONE" { count(); yylval.ival = 3; return(INTEGER_CONSTANT); }
|
||||
"MASK_NEXT" { count(); yylval.ival = 4; return(INTEGER_CONSTANT); }
|
||||
|
||||
"PERM_TRANSFER" { count(); yylval.ival = PERM_TRANSFER; return(INTEGER_CONSTANT); }
|
||||
"PERM_MODIFY" { count(); yylval.ival = PERM_MODIFY; return(INTEGER_CONSTANT); }
|
||||
"PERM_COPY" { count(); yylval.ival = PERM_COPY; return(INTEGER_CONSTANT); }
|
||||
"PERM_MOVE" { count(); yylval.ival = PERM_MOVE; return(INTEGER_CONSTANT); }
|
||||
"PERM_ALL" { count(); yylval.ival = PERM_ALL; return(INTEGER_CONSTANT); }
|
||||
|
||||
"PARCEL_MEDIA_COMMAND_STOP" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_STOP; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_MEDIA_COMMAND_PAUSE" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_PAUSE; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_MEDIA_COMMAND_PLAY" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_PLAY; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_MEDIA_COMMAND_LOOP" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_LOOP; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_MEDIA_COMMAND_TEXTURE" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_TEXTURE; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_MEDIA_COMMAND_URL" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_URL; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_MEDIA_COMMAND_TIME" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_TIME; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_MEDIA_COMMAND_AGENT" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_AGENT; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_MEDIA_COMMAND_UNLOAD" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_UNLOAD; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_MEDIA_COMMAND_AUTO_ALIGN" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_AUTO_ALIGN; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_MEDIA_COMMAND_TYPE" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_TYPE; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_MEDIA_COMMAND_SIZE" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_SIZE; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_MEDIA_COMMAND_DESC" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_DESC; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_MEDIA_COMMAND_LOOP_SET" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_LOOP_SET; return(INTEGER_CONSTANT); }
|
||||
|
||||
"LIST_STAT_MAX" { count(); yylval.ival = LIST_STAT_MAX; return(INTEGER_CONSTANT); }
|
||||
"LIST_STAT_MIN" { count(); yylval.ival = LIST_STAT_MIN; return(INTEGER_CONSTANT); }
|
||||
"LIST_STAT_MEAN" { count(); yylval.ival = LIST_STAT_MEAN; return(INTEGER_CONSTANT); }
|
||||
"LIST_STAT_MEDIAN" { count(); yylval.ival = LIST_STAT_MEDIAN; return(INTEGER_CONSTANT); }
|
||||
"LIST_STAT_STD_DEV" { count(); yylval.ival = LIST_STAT_STD_DEV; return(INTEGER_CONSTANT); }
|
||||
"LIST_STAT_SUM" { count(); yylval.ival = LIST_STAT_SUM; return(INTEGER_CONSTANT); }
|
||||
"LIST_STAT_SUM_SQUARES" { count(); yylval.ival = LIST_STAT_SUM_SQUARES; return(INTEGER_CONSTANT); }
|
||||
"LIST_STAT_NUM_COUNT" { count(); yylval.ival = LIST_STAT_NUM_COUNT; return(INTEGER_CONSTANT); }
|
||||
"LIST_STAT_GEOMETRIC_MEAN" { count(); yylval.ival = LIST_STAT_GEO_MEAN; return(INTEGER_CONSTANT); }
|
||||
"LIST_STAT_RANGE" { count(); yylval.ival = LIST_STAT_RANGE; return(INTEGER_CONSTANT); }
|
||||
|
||||
"PAY_HIDE" { count(); yylval.ival = PAY_PRICE_HIDE; return(INTEGER_CONSTANT); }
|
||||
"PAY_DEFAULT" { count(); yylval.ival = PAY_PRICE_DEFAULT; return(INTEGER_CONSTANT); }
|
||||
|
||||
"PARCEL_FLAG_ALLOW_FLY" { count(); yylval.ival = PF_ALLOW_FLY; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_FLAG_ALLOW_GROUP_SCRIPTS" { count(); yylval.ival = PF_ALLOW_GROUP_SCRIPTS; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_FLAG_ALLOW_SCRIPTS" { count(); yylval.ival = PF_ALLOW_OTHER_SCRIPTS; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_FLAG_ALLOW_LANDMARK" { count(); yylval.ival = PF_ALLOW_LANDMARK; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_FLAG_ALLOW_TERRAFORM" { count(); yylval.ival = PF_ALLOW_TERRAFORM; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_FLAG_ALLOW_DAMAGE" { count(); yylval.ival = PF_ALLOW_DAMAGE; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_FLAG_ALLOW_CREATE_OBJECTS" { count(); yylval.ival = PF_CREATE_OBJECTS; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_FLAG_ALLOW_CREATE_GROUP_OBJECTS" { count(); yylval.ival = PF_CREATE_GROUP_OBJECTS; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_FLAG_USE_ACCESS_GROUP" { count(); yylval.ival = PF_USE_ACCESS_GROUP; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_FLAG_USE_ACCESS_LIST" { count(); yylval.ival = PF_USE_ACCESS_LIST; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_FLAG_USE_BAN_LIST" { count(); yylval.ival = PF_USE_BAN_LIST; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_FLAG_USE_LAND_PASS_LIST" { count(); yylval.ival = PF_USE_PASS_LIST; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_FLAG_LOCAL_SOUND_ONLY" { count(); yylval.ival = PF_SOUND_LOCAL; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_FLAG_RESTRICT_PUSHOBJECT" { count(); yylval.ival = PF_RESTRICT_PUSHOBJECT; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_FLAG_ALLOW_GROUP_OBJECT_ENTRY" { count(); yylval.ival = PF_ALLOW_GROUP_OBJECT_ENTRY; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_FLAG_ALLOW_ALL_OBJECT_ENTRY" { count(); yylval.ival = PF_ALLOW_ALL_OBJECT_ENTRY; return(INTEGER_CONSTANT); }
|
||||
|
||||
"REGION_FLAG_ALLOW_DAMAGE" { count(); yylval.ival = REGION_FLAGS_ALLOW_DAMAGE; return(INTEGER_CONSTANT); }
|
||||
"REGION_FLAG_FIXED_SUN" { count(); yylval.ival = REGION_FLAGS_SUN_FIXED; return(INTEGER_CONSTANT); }
|
||||
"REGION_FLAG_BLOCK_TERRAFORM" { count(); yylval.ival = REGION_FLAGS_BLOCK_TERRAFORM; return(INTEGER_CONSTANT); }
|
||||
"REGION_FLAG_SANDBOX" { count(); yylval.ival = REGION_FLAGS_SANDBOX; return(INTEGER_CONSTANT); }
|
||||
"REGION_FLAG_DISABLE_COLLISIONS" { count(); yylval.ival = REGION_FLAGS_SKIP_COLLISIONS; return(INTEGER_CONSTANT); }
|
||||
"REGION_FLAG_DISABLE_PHYSICS" { count(); yylval.ival = REGION_FLAGS_SKIP_PHYSICS; return(INTEGER_CONSTANT); }
|
||||
"REGION_FLAG_BLOCK_FLY" { count(); yylval.ival = REGION_FLAGS_BLOCK_FLY; return(INTEGER_CONSTANT); }
|
||||
"REGION_FLAG_ALLOW_DIRECT_TELEPORT" { count(); yylval.ival = REGION_FLAGS_ALLOW_DIRECT_TELEPORT; return(INTEGER_CONSTANT); }
|
||||
"REGION_FLAG_RESTRICT_PUSHOBJECT" { count(); yylval.ival = REGION_FLAGS_RESTRICT_PUSHOBJECT; return(INTEGER_CONSTANT); }
|
||||
|
||||
"HTTP_METHOD" { count(); yylval.ival = HTTP_METHOD; return(INTEGER_CONSTANT); }
|
||||
"HTTP_MIMETYPE" { count(); yylval.ival = HTTP_MIMETYPE; return(INTEGER_CONSTANT); }
|
||||
"HTTP_BODY_MAXLENGTH" { count(); yylval.ival = HTTP_BODY_MAXLENGTH; return(INTEGER_CONSTANT); }
|
||||
"HTTP_BODY_TRUNCATED" { count(); yylval.ival = HTTP_BODY_TRUNCATED; return(INTEGER_CONSTANT); }
|
||||
"HTTP_VERIFY_CERT" { count(); yylval.ival = HTTP_VERIFY_CERT; return(INTEGER_CONSTANT); }
|
||||
|
||||
"PARCEL_COUNT_TOTAL" { count(); yylval.ival = OC_TOTAL; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_COUNT_OWNER" { count(); yylval.ival = OC_OWNER; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_COUNT_GROUP" { count(); yylval.ival = OC_GROUP; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_COUNT_OTHER" { count(); yylval.ival = OC_OTHER; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_COUNT_SELECTED" { count(); yylval.ival = OC_SELECTED; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_COUNT_TEMP" { count(); yylval.ival = OC_TEMP; return(INTEGER_CONSTANT); }
|
||||
|
||||
"PARCEL_DETAILS_NAME" { count(); yylval.ival = PARCEL_DETAILS_NAME; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_DETAILS_DESC" { count(); yylval.ival = PARCEL_DETAILS_DESC; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_DETAILS_OWNER" { count(); yylval.ival = PARCEL_DETAILS_OWNER; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_DETAILS_GROUP" { count(); yylval.ival = PARCEL_DETAILS_GROUP; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_DETAILS_AREA" { count(); yylval.ival = PARCEL_DETAILS_AREA; return(INTEGER_CONSTANT); }
|
||||
|
||||
"STRING_TRIM_HEAD" { count(); yylval.ival = STRING_TRIM_HEAD; return(INTEGER_CONSTANT); }
|
||||
"STRING_TRIM_TAIL" { count(); yylval.ival = STRING_TRIM_TAIL; return(INTEGER_CONSTANT); }
|
||||
"STRING_TRIM" { count(); yylval.ival = STRING_TRIM; return(INTEGER_CONSTANT); }
|
||||
|
||||
"CLICK_ACTION_NONE" { count(); yylval.ival = CLICK_ACTION_NONE; return(INTEGER_CONSTANT); }
|
||||
"CLICK_ACTION_TOUCH" { count(); yylval.ival = CLICK_ACTION_TOUCH; return(INTEGER_CONSTANT); }
|
||||
"CLICK_ACTION_SIT" { count(); yylval.ival = CLICK_ACTION_SIT; return(INTEGER_CONSTANT); }
|
||||
"CLICK_ACTION_BUY" { count(); yylval.ival = CLICK_ACTION_BUY; return(INTEGER_CONSTANT); }
|
||||
"CLICK_ACTION_PAY" { count(); yylval.ival = CLICK_ACTION_PAY; return(INTEGER_CONSTANT); }
|
||||
"CLICK_ACTION_OPEN" { count(); yylval.ival = CLICK_ACTION_OPEN; return(INTEGER_CONSTANT); }
|
||||
"CLICK_ACTION_PLAY" { count(); yylval.ival = CLICK_ACTION_PLAY; return(INTEGER_CONSTANT); }
|
||||
"CLICK_ACTION_OPEN_MEDIA" { count(); yylval.ival = CLICK_ACTION_OPEN_MEDIA; return(INTEGER_CONSTANT); }
|
||||
|
||||
"TEXTURE_BLANK" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, "5748decc-f629-461c-9a36-a35a221fe21f"); return(STRING_CONSTANT); }
|
||||
"TEXTURE_DEFAULT" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, "89556747-24cb-43ed-920b-47caed15465f"); return(STRING_CONSTANT); }
|
||||
"TEXTURE_MEDIA" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, "8b5fec65-8d8d-9dc5-cda8-8fdf2716e361"); return(STRING_CONSTANT); }
|
||||
"TEXTURE_PLYWOOD" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, "89556747-24cb-43ed-920b-47caed15465f"); return(STRING_CONSTANT); }
|
||||
"TEXTURE_TRANSPARENT" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, "8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"); return(STRING_CONSTANT); }
|
||||
|
||||
"TOUCH_INVALID_FACE" { count(); yylval.ival = -1; return(INTEGER_CONSTANT); }
|
||||
"TOUCH_INVALID_VECTOR" { count(); return(TOUCH_INVALID_VECTOR); }
|
||||
"TOUCH_INVALID_TEXCOORD" { count(); return(TOUCH_INVALID_TEXCOORD); }
|
||||
|
||||
|
||||
{L}({L}|{N})* { count(); yylval.sval = new char[strlen(yytext) + 1]; strcpy(yylval.sval, yytext); return(IDENTIFIER); }
|
||||
|
||||
{N}+{E} { count(); yylval.fval = (F32)atof(yytext); return(FP_CONSTANT); }
|
||||
{N}*"."{N}+({E})?{FS}? { count(); yylval.fval = (F32)atof(yytext); return(FP_CONSTANT); }
|
||||
{N}+"."{N}*({E})?{FS}? { count(); yylval.fval = (F32)atof(yytext); return(FP_CONSTANT); }
|
||||
|
||||
L?\"(\\.|[^\\"])*\" { parse_string(); count(); return(STRING_CONSTANT); }
|
||||
|
||||
"++" { count(); return(INC_OP); }
|
||||
"--" { count(); return(DEC_OP); }
|
||||
"+=" { count(); return(ADD_ASSIGN); }
|
||||
"-=" { count(); return(SUB_ASSIGN); }
|
||||
"*=" { count(); return(MUL_ASSIGN); }
|
||||
"/=" { count(); return(DIV_ASSIGN); }
|
||||
"%=" { count(); return(MOD_ASSIGN); }
|
||||
";" { count(); return(';'); }
|
||||
"{" { count(); return('{'); }
|
||||
"}" { count(); return('}'); }
|
||||
"," { count(); return(','); }
|
||||
"=" { count(); return('='); }
|
||||
"(" { count(); return('('); }
|
||||
")" { count(); return(')'); }
|
||||
"-" { count(); return('-'); }
|
||||
"+" { count(); return('+'); }
|
||||
"*" { count(); return('*'); }
|
||||
"/" { count(); return('/'); }
|
||||
"%" { count(); return('%'); }
|
||||
"@" { count(); return('@'); }
|
||||
":" { count(); return(':'); }
|
||||
">" { count(); return('>'); }
|
||||
"<" { count(); return('<'); }
|
||||
"]" { count(); return(']'); }
|
||||
"[" { count(); return('['); }
|
||||
"==" { count(); return(EQ); }
|
||||
"!=" { count(); return(NEQ); }
|
||||
">=" { count(); return(GEQ); }
|
||||
"<=" { count(); return(LEQ); }
|
||||
"&" { count(); return('&'); }
|
||||
"|" { count(); return('|'); }
|
||||
"^" { count(); return('^'); }
|
||||
"~" { count(); return('~'); }
|
||||
"!" { count(); return('!'); }
|
||||
"&&" { count(); return(BOOLEAN_AND); }
|
||||
"||" { count(); return(BOOLEAN_OR); }
|
||||
"<<" { count(); return(SHIFT_LEFT); }
|
||||
">>" { count(); return(SHIFT_RIGHT); }
|
||||
|
||||
[ \t\v\n\f] { count(); }
|
||||
. { /* ignore bad characters */ }
|
||||
|
||||
%%
|
||||
|
||||
LLScriptAllocationManager *gAllocationManager;
|
||||
LLScriptScript *gScriptp;
|
||||
|
||||
// Prototype for the yacc parser entry point
|
||||
int yyparse(void);
|
||||
|
||||
int yyerror(const char *fmt, ...)
|
||||
{
|
||||
gErrorToText.writeError(yyout, gLine, gColumn, LSERROR_SYNTAX_ERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//#define EMERGENCY_DEBUG_PRINTOUTS
|
||||
//#define EMIT_CIL_ASSEMBLER
|
||||
|
||||
BOOL lscript_compile(const char* src_filename, const char* dst_filename,
|
||||
const char* err_filename, BOOL compile_to_mono, const char* class_name, BOOL is_god_like)
|
||||
{
|
||||
BOOL b_parse_ok = FALSE;
|
||||
BOOL b_dummy = FALSE;
|
||||
U64 b_dummy_count = FALSE;
|
||||
LSCRIPTType type = LST_NULL;
|
||||
|
||||
gInternalColumn = 0;
|
||||
gInternalLine = 0;
|
||||
gScriptp = NULL;
|
||||
|
||||
gErrorToText.init();
|
||||
init_supported_expressions();
|
||||
init_temp_jumps();
|
||||
gAllocationManager = new LLScriptAllocationManager();
|
||||
|
||||
yyin = LLFile::fopen(std::string(src_filename), "r");
|
||||
if (yyin)
|
||||
{
|
||||
yyout = LLFile::fopen(std::string(err_filename), "w");
|
||||
|
||||
// Reset the lexer's internal buffering.
|
||||
|
||||
yyrestart(yyin);
|
||||
|
||||
b_parse_ok = !yyparse();
|
||||
|
||||
if (b_parse_ok)
|
||||
{
|
||||
#ifdef EMERGENCY_DEBUG_PRINTOUTS
|
||||
char compiled[256];
|
||||
sprintf(compiled, "%s.o", src_filename);
|
||||
LLFILE* compfile;
|
||||
compfile = LLFile::fopen(compiled, "w");
|
||||
#endif
|
||||
|
||||
if(dst_filename)
|
||||
{
|
||||
gScriptp->setBytecodeDest(dst_filename);
|
||||
}
|
||||
|
||||
gScriptp->mGodLike = is_god_like;
|
||||
|
||||
gScriptp->setClassName(class_name);
|
||||
|
||||
gScopeStringTable = new LLStringTable(16384);
|
||||
#ifdef EMERGENCY_DEBUG_PRINTOUTS
|
||||
gScriptp->recurse(compfile, 0, 4, LSCP_PRETTY_PRINT, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL);
|
||||
#endif
|
||||
gScriptp->recurse(yyout, 0, 0, LSCP_PRUNE, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL);
|
||||
gScriptp->recurse(yyout, 0, 0, LSCP_SCOPE_PASS1, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL);
|
||||
gScriptp->recurse(yyout, 0, 0, LSCP_SCOPE_PASS2, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL);
|
||||
gScriptp->recurse(yyout, 0, 0, LSCP_TYPE, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL);
|
||||
if (!gErrorToText.getErrors())
|
||||
{
|
||||
gScriptp->recurse(yyout, 0, 0, LSCP_RESOURCE, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL);
|
||||
#ifdef EMERGENCY_DEBUG_PRINTOUTS
|
||||
gScriptp->recurse(yyout, 0, 0, LSCP_EMIT_ASSEMBLY, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL);
|
||||
#endif
|
||||
if(TRUE == compile_to_mono)
|
||||
{
|
||||
gScriptp->recurse(yyout, 0, 0, LSCP_EMIT_CIL_ASSEMBLY, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
gScriptp->recurse(yyout, 0, 0, LSCP_EMIT_BYTE_CODE, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL);
|
||||
}
|
||||
}
|
||||
delete gScopeStringTable;
|
||||
gScopeStringTable = NULL;
|
||||
#ifdef EMERGENCY_DEBUG_PRINTOUTS
|
||||
fclose(compfile);
|
||||
#endif
|
||||
}
|
||||
fclose(yyout);
|
||||
fclose(yyin);
|
||||
}
|
||||
|
||||
delete gAllocationManager;
|
||||
delete gScopeStringTable;
|
||||
|
||||
return b_parse_ok && !gErrorToText.getErrors();
|
||||
}
|
||||
|
||||
|
||||
BOOL lscript_compile(char *filename, BOOL compile_to_mono, BOOL is_god_like = FALSE)
|
||||
{
|
||||
char src_filename[MAX_STRING];
|
||||
sprintf(src_filename, "%s.lsl", filename);
|
||||
char err_filename[MAX_STRING];
|
||||
sprintf(err_filename, "%s.out", filename);
|
||||
char class_name[MAX_STRING];
|
||||
sprintf(class_name, "%s", filename);
|
||||
return lscript_compile(src_filename, NULL, err_filename, compile_to_mono, class_name, is_god_like);
|
||||
}
|
||||
|
||||
|
||||
S32 yywrap()
|
||||
{
|
||||
#if defined(FLEX_SCANNER) && !defined(LL_WINDOWS)
|
||||
// get gcc to stop complaining about lack of use of yyunput
|
||||
(void) yyunput;
|
||||
#endif
|
||||
return(1);
|
||||
}
|
||||
|
||||
void line_comment()
|
||||
{
|
||||
char c;
|
||||
|
||||
while ((c = yyinput()) != '\n' && c != 0 && c != EOF)
|
||||
;
|
||||
}
|
||||
|
||||
void block_comment()
|
||||
{
|
||||
char c1 = 0;
|
||||
char c2 = yyinput();
|
||||
while (c2 != 0 && c2 != EOF && !(c1 == '*' && c2 == '/')) {
|
||||
if (c2 == '\n')
|
||||
{
|
||||
gInternalLine++;
|
||||
gInternalColumn = 0;
|
||||
}
|
||||
else if (c2 == '\t')
|
||||
gInternalColumn += 4 - (gInternalColumn % 8);
|
||||
else
|
||||
gInternalColumn++;
|
||||
c1 = c2;
|
||||
c2 = yyinput();
|
||||
}
|
||||
}
|
||||
|
||||
void count()
|
||||
{
|
||||
S32 i;
|
||||
|
||||
gColumn = gInternalColumn;
|
||||
gLine = gInternalLine;
|
||||
|
||||
for (i = 0; yytext[i] != '\0'; i++)
|
||||
if (yytext[i] == '\n')
|
||||
{
|
||||
gInternalLine++;
|
||||
gInternalColumn = 0;
|
||||
}
|
||||
else if (yytext[i] == '\t')
|
||||
gInternalColumn += 4 - (gInternalColumn % 8);
|
||||
else
|
||||
gInternalColumn++;
|
||||
}
|
||||
|
||||
void parse_string()
|
||||
{
|
||||
S32 length = (S32)strlen(yytext);
|
||||
length = length - 2;
|
||||
char *temp = yytext + 1;
|
||||
|
||||
S32 i;
|
||||
S32 escapes = 0;
|
||||
S32 tabs = 0;
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
if (temp[i] == '\\')
|
||||
{
|
||||
escapes++;
|
||||
i++;
|
||||
if (temp[i] == 't')
|
||||
tabs++;
|
||||
}
|
||||
}
|
||||
|
||||
S32 newlength = length - escapes + tabs*3;
|
||||
yylval.sval = new char[newlength + 1];
|
||||
|
||||
char *dest = yylval.sval;
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
if (temp[i] == '\\')
|
||||
{
|
||||
i++;
|
||||
// linefeed
|
||||
if (temp[i] == 'n')
|
||||
{
|
||||
*dest++ = 10;
|
||||
}
|
||||
else if (temp[i] == 't')
|
||||
{
|
||||
*dest++ = ' ';
|
||||
*dest++ = ' ';
|
||||
*dest++ = ' ';
|
||||
*dest++ = ' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
*dest++ = temp[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*dest++ = temp[i];
|
||||
}
|
||||
}
|
||||
yylval.sval[newlength] = 0;
|
||||
}
|
||||
1807
indra/lscript/lscript_compile/indra.y
Normal file
1807
indra/lscript/lscript_compile/indra.y
Normal file
File diff suppressed because it is too large
Load Diff
6774
indra/lscript/lscript_compile/indra_generated.l.cpp
Normal file
6774
indra/lscript/lscript_compile/indra_generated.l.cpp
Normal file
File diff suppressed because it is too large
Load Diff
4682
indra/lscript/lscript_compile/indra_generated.y.cpp
Normal file
4682
indra/lscript/lscript_compile/indra_generated.y.cpp
Normal file
File diff suppressed because it is too large
Load Diff
164
indra/lscript/lscript_compile/indra_generated.y.hpp
Normal file
164
indra/lscript/lscript_compile/indra_generated.y.hpp
Normal file
@@ -0,0 +1,164 @@
|
||||
|
||||
/* A Bison parser, made by GNU Bison 2.4.1. */
|
||||
|
||||
/* Skeleton interface for Bison's Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* As a special exception, you may create a larger work that contains
|
||||
part or all of the Bison parser skeleton and distribute that work
|
||||
under terms of your choice, so long as that work isn't itself a
|
||||
parser generator using the skeleton or a modified version thereof
|
||||
as a parser skeleton. Alternatively, if you modify or redistribute
|
||||
the parser skeleton itself, you may (at your option) remove this
|
||||
special exception, which will cause the skeleton and the resulting
|
||||
Bison output files to be licensed under the GNU General Public
|
||||
License without this special exception.
|
||||
|
||||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
|
||||
/* Tokens. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||
know about them. */
|
||||
enum yytokentype {
|
||||
INTEGER = 258,
|
||||
FLOAT_TYPE = 259,
|
||||
STRING = 260,
|
||||
LLKEY = 261,
|
||||
VECTOR = 262,
|
||||
QUATERNION = 263,
|
||||
LIST = 264,
|
||||
STATE = 265,
|
||||
EVENT = 266,
|
||||
JUMP = 267,
|
||||
RETURN = 268,
|
||||
STATE_ENTRY = 269,
|
||||
STATE_EXIT = 270,
|
||||
TOUCH_START = 271,
|
||||
TOUCH = 272,
|
||||
TOUCH_END = 273,
|
||||
COLLISION_START = 274,
|
||||
COLLISION = 275,
|
||||
COLLISION_END = 276,
|
||||
LAND_COLLISION_START = 277,
|
||||
LAND_COLLISION = 278,
|
||||
LAND_COLLISION_END = 279,
|
||||
TIMER = 280,
|
||||
CHAT = 281,
|
||||
SENSOR = 282,
|
||||
NO_SENSOR = 283,
|
||||
CONTROL = 284,
|
||||
AT_TARGET = 285,
|
||||
NOT_AT_TARGET = 286,
|
||||
AT_ROT_TARGET = 287,
|
||||
NOT_AT_ROT_TARGET = 288,
|
||||
MONEY = 289,
|
||||
EMAIL = 290,
|
||||
RUN_TIME_PERMISSIONS = 291,
|
||||
INVENTORY = 292,
|
||||
ATTACH = 293,
|
||||
DATASERVER = 294,
|
||||
MOVING_START = 295,
|
||||
MOVING_END = 296,
|
||||
REZ = 297,
|
||||
OBJECT_REZ = 298,
|
||||
LINK_MESSAGE = 299,
|
||||
REMOTE_DATA = 300,
|
||||
HTTP_RESPONSE = 301,
|
||||
HTTP_REQUEST = 302,
|
||||
IDENTIFIER = 303,
|
||||
STATE_DEFAULT = 304,
|
||||
INTEGER_CONSTANT = 305,
|
||||
INTEGER_TRUE = 306,
|
||||
INTEGER_FALSE = 307,
|
||||
FP_CONSTANT = 308,
|
||||
STRING_CONSTANT = 309,
|
||||
INC_OP = 310,
|
||||
DEC_OP = 311,
|
||||
ADD_ASSIGN = 312,
|
||||
SUB_ASSIGN = 313,
|
||||
MUL_ASSIGN = 314,
|
||||
DIV_ASSIGN = 315,
|
||||
MOD_ASSIGN = 316,
|
||||
EQ = 317,
|
||||
NEQ = 318,
|
||||
GEQ = 319,
|
||||
LEQ = 320,
|
||||
BOOLEAN_AND = 321,
|
||||
BOOLEAN_OR = 322,
|
||||
SHIFT_LEFT = 323,
|
||||
SHIFT_RIGHT = 324,
|
||||
IF = 325,
|
||||
ELSE = 326,
|
||||
FOR = 327,
|
||||
DO = 328,
|
||||
WHILE = 329,
|
||||
PRINT = 330,
|
||||
PERIOD = 331,
|
||||
ZERO_VECTOR = 332,
|
||||
ZERO_ROTATION = 333,
|
||||
TOUCH_INVALID_VECTOR = 334,
|
||||
TOUCH_INVALID_TEXCOORD = 335,
|
||||
LOWER_THAN_ELSE = 336,
|
||||
INITIALIZER = 337
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
typedef union YYSTYPE
|
||||
{
|
||||
|
||||
/* Line 1676 of yacc.c */
|
||||
#line 38 "indra.y"
|
||||
|
||||
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;
|
||||
|
||||
|
||||
|
||||
/* Line 1676 of yacc.c */
|
||||
#line 156 "indra_generated.y.hpp"
|
||||
} YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
#endif
|
||||
|
||||
extern YYSTYPE yylval;
|
||||
|
||||
|
||||
32
indra/lscript/lscript_compile/lscript_alloc.cpp
Normal file
32
indra/lscript/lscript_compile/lscript_alloc.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* @file lscript_alloc.cpp
|
||||
* @brief Allocation tracking
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2009, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
326
indra/lscript/lscript_compile/lscript_bytecode.cpp
Normal file
326
indra/lscript/lscript_compile/lscript_bytecode.cpp
Normal file
@@ -0,0 +1,326 @@
|
||||
/**
|
||||
* @file lscript_bytecode.cpp
|
||||
* @brief classes to build actual bytecode
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2009, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "lscript_bytecode.h"
|
||||
#include "lscript_error.h"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(disable: 4102) // 'yy_more' : unreferenced label
|
||||
# pragma warning(disable: 4702) // unreachable code
|
||||
#endif
|
||||
|
||||
LLScriptJumpTable::LLScriptJumpTable()
|
||||
{
|
||||
}
|
||||
|
||||
LLScriptJumpTable::~LLScriptJumpTable()
|
||||
{
|
||||
mLabelMap.deleteAllData();
|
||||
mJumpMap.deleteAllData();
|
||||
}
|
||||
|
||||
void LLScriptJumpTable::addLabel(char *name, S32 offset)
|
||||
{
|
||||
char *temp = gScopeStringTable->addString(name);
|
||||
mLabelMap[temp] = new S32(offset);
|
||||
}
|
||||
|
||||
void LLScriptJumpTable::addJump(char *name, S32 offset)
|
||||
{
|
||||
char *temp = gScopeStringTable->addString(name);
|
||||
mJumpMap[temp] = new S32(offset);
|
||||
}
|
||||
|
||||
|
||||
LLScriptByteCodeChunk::LLScriptByteCodeChunk(BOOL b_need_jumps)
|
||||
: mCodeChunk(NULL), mCurrentOffset(0), mJumpTable(NULL)
|
||||
{
|
||||
if (b_need_jumps)
|
||||
{
|
||||
mJumpTable = new LLScriptJumpTable();
|
||||
}
|
||||
}
|
||||
|
||||
LLScriptByteCodeChunk::~LLScriptByteCodeChunk()
|
||||
{
|
||||
delete [] mCodeChunk;
|
||||
delete mJumpTable;
|
||||
}
|
||||
|
||||
void LLScriptByteCodeChunk::addByte(U8 byte)
|
||||
{
|
||||
if (mCodeChunk)
|
||||
{
|
||||
U8 *temp = new U8[mCurrentOffset + 1];
|
||||
memcpy(temp, mCodeChunk, mCurrentOffset); /* Flawfinder: ignore */
|
||||
delete [] mCodeChunk;
|
||||
mCodeChunk = temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
mCodeChunk = new U8[1];
|
||||
}
|
||||
*(mCodeChunk + mCurrentOffset++) = byte;
|
||||
}
|
||||
|
||||
void LLScriptByteCodeChunk::addU16(U16 data)
|
||||
{
|
||||
U8 temp[2];
|
||||
S32 offset = 0;
|
||||
u162bytestream(temp, offset, data);
|
||||
addBytes(temp, 2);
|
||||
}
|
||||
|
||||
void LLScriptByteCodeChunk::addBytes(const U8 *bytes, S32 size)
|
||||
{
|
||||
if (mCodeChunk)
|
||||
{
|
||||
U8 *temp = new U8[mCurrentOffset + size];
|
||||
memcpy(temp, mCodeChunk, mCurrentOffset); /* Flawfinder: ignore */
|
||||
delete [] mCodeChunk;
|
||||
mCodeChunk = temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
mCodeChunk = new U8[size];
|
||||
}
|
||||
memcpy(mCodeChunk + mCurrentOffset, bytes, size);/* Flawfinder: ignore */
|
||||
mCurrentOffset += size;
|
||||
}
|
||||
|
||||
void LLScriptByteCodeChunk::addBytes(const char *bytes, S32 size)
|
||||
{
|
||||
if (mCodeChunk)
|
||||
{
|
||||
U8 *temp = new U8[mCurrentOffset + size];
|
||||
memcpy(temp, mCodeChunk, mCurrentOffset); /*Flawfinder: ignore*/
|
||||
delete [] mCodeChunk;
|
||||
mCodeChunk = temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
mCodeChunk = new U8[size];
|
||||
}
|
||||
memcpy(mCodeChunk + mCurrentOffset, bytes, size); /*Flawfinder: ignore*/
|
||||
mCurrentOffset += size;
|
||||
}
|
||||
|
||||
void LLScriptByteCodeChunk::addBytes(S32 size)
|
||||
{
|
||||
if (mCodeChunk)
|
||||
{
|
||||
U8 *temp = new U8[mCurrentOffset + size];
|
||||
memcpy(temp, mCodeChunk, mCurrentOffset); /*Flawfinder: ignore*/
|
||||
delete [] mCodeChunk;
|
||||
mCodeChunk = temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
mCodeChunk = new U8[size];
|
||||
}
|
||||
memset(mCodeChunk + mCurrentOffset, 0, size);
|
||||
mCurrentOffset += size;
|
||||
}
|
||||
|
||||
void LLScriptByteCodeChunk::addBytesDontInc(S32 size)
|
||||
{
|
||||
if (mCodeChunk)
|
||||
{
|
||||
U8 *temp = new U8[mCurrentOffset + size];
|
||||
memcpy(temp, mCodeChunk, mCurrentOffset); /*Flawfinder: ignore*/
|
||||
delete [] mCodeChunk;
|
||||
mCodeChunk = temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
mCodeChunk = new U8[size];
|
||||
}
|
||||
memset(mCodeChunk + mCurrentOffset, 0, size);
|
||||
}
|
||||
|
||||
void LLScriptByteCodeChunk::addInteger(S32 value)
|
||||
{
|
||||
U8 temp[4];
|
||||
S32 offset = 0;
|
||||
integer2bytestream(temp, offset, value);
|
||||
addBytes(temp, 4);
|
||||
}
|
||||
|
||||
void LLScriptByteCodeChunk::addFloat(F32 value)
|
||||
{
|
||||
U8 temp[4];
|
||||
S32 offset = 0;
|
||||
float2bytestream(temp, offset, value);
|
||||
addBytes(temp, 4);
|
||||
}
|
||||
|
||||
void LLScriptByteCodeChunk::addLabel(char *name)
|
||||
{
|
||||
if (mJumpTable)
|
||||
{
|
||||
mJumpTable->addLabel(name, mCurrentOffset);
|
||||
}
|
||||
}
|
||||
|
||||
void LLScriptByteCodeChunk::addJump(char *name)
|
||||
{
|
||||
if (mJumpTable)
|
||||
{
|
||||
mJumpTable->addJump(name, mCurrentOffset);
|
||||
}
|
||||
}
|
||||
|
||||
// format is Byte 0: jump op code Byte 1 - 4: offset
|
||||
// the jump position points to Byte 5, so we need to add the data at
|
||||
// offset - 4, offset - 3, offset - 2, and offset - 1
|
||||
|
||||
// offset is label - jump
|
||||
|
||||
void LLScriptByteCodeChunk::connectJumps()
|
||||
{
|
||||
char *jump;
|
||||
S32 offset, jumppos;
|
||||
|
||||
if (mJumpTable)
|
||||
{
|
||||
for (jump = mJumpTable->mJumpMap.getFirstKey();
|
||||
jump;
|
||||
jump = mJumpTable->mJumpMap.getNextKey())
|
||||
{
|
||||
jumppos = *mJumpTable->mJumpMap[jump];
|
||||
offset = *mJumpTable->mLabelMap[jump] - jumppos;
|
||||
jumppos = jumppos - 4;
|
||||
integer2bytestream(mCodeChunk, jumppos, offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LLScriptScriptCodeChunk::LLScriptScriptCodeChunk(S32 total_size)
|
||||
: mTotalSize(total_size), mCompleteCode(NULL)
|
||||
{
|
||||
mRegisters = new LLScriptByteCodeChunk(FALSE);
|
||||
mGlobalVariables = new LLScriptByteCodeChunk(FALSE);
|
||||
mGlobalFunctions = new LLScriptByteCodeChunk(FALSE);
|
||||
mStates = new LLScriptByteCodeChunk(FALSE);
|
||||
mHeap = new LLScriptByteCodeChunk(FALSE);
|
||||
}
|
||||
|
||||
LLScriptScriptCodeChunk::~LLScriptScriptCodeChunk()
|
||||
{
|
||||
delete mRegisters;
|
||||
delete mGlobalVariables;
|
||||
delete mGlobalFunctions;
|
||||
delete mStates;
|
||||
delete mHeap;
|
||||
delete [] mCompleteCode;
|
||||
}
|
||||
|
||||
void LLScriptScriptCodeChunk::build(LLFILE *efp, LLFILE *bcfp)
|
||||
{
|
||||
S32 code_data_size = mRegisters->mCurrentOffset +
|
||||
mGlobalVariables->mCurrentOffset +
|
||||
mGlobalFunctions->mCurrentOffset +
|
||||
mStates->mCurrentOffset +
|
||||
mHeap->mCurrentOffset;
|
||||
|
||||
S32 offset = 0;
|
||||
|
||||
if (code_data_size < mTotalSize)
|
||||
{
|
||||
mCompleteCode = new U8[mTotalSize];
|
||||
memset(mCompleteCode, 0, mTotalSize);
|
||||
|
||||
memcpy(mCompleteCode, mRegisters->mCodeChunk, mRegisters->mCurrentOffset);
|
||||
offset += mRegisters->mCurrentOffset;
|
||||
|
||||
set_register(mCompleteCode, LREG_IP, 0);
|
||||
set_register(mCompleteCode, LREG_VN, LSL2_VERSION_NUMBER);
|
||||
set_event_register(mCompleteCode, LREG_IE, 0, LSL2_CURRENT_MAJOR_VERSION);
|
||||
set_register(mCompleteCode, LREG_BP, mTotalSize - 1);
|
||||
set_register(mCompleteCode, LREG_SP, mTotalSize - 1);
|
||||
|
||||
set_register(mCompleteCode, LREG_GVR, offset);
|
||||
|
||||
memcpy(mCompleteCode + offset, mGlobalVariables->mCodeChunk, mGlobalVariables->mCurrentOffset); /*Flawfinder: ignore*/
|
||||
offset += mGlobalVariables->mCurrentOffset;
|
||||
|
||||
set_register(mCompleteCode, LREG_GFR, offset);
|
||||
|
||||
memcpy(mCompleteCode + offset, mGlobalFunctions->mCodeChunk, mGlobalFunctions->mCurrentOffset); /*Flawfinder: ignore*/
|
||||
offset += mGlobalFunctions->mCurrentOffset;
|
||||
|
||||
set_register(mCompleteCode, LREG_SR, offset);
|
||||
// zero is, by definition the default state
|
||||
set_register(mCompleteCode, LREG_CS, 0);
|
||||
set_register(mCompleteCode, LREG_NS, 0);
|
||||
set_event_register(mCompleteCode, LREG_CE, LSCRIPTStateBitField[LSTT_STATE_ENTRY], LSL2_CURRENT_MAJOR_VERSION);
|
||||
S32 default_state_offset = 0;
|
||||
if (LSL2_CURRENT_MAJOR_VERSION == LSL2_MAJOR_VERSION_TWO)
|
||||
{
|
||||
default_state_offset = 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
default_state_offset = 4;
|
||||
}
|
||||
set_event_register(mCompleteCode, LREG_ER, bytestream2u64(mStates->mCodeChunk, default_state_offset), LSL2_CURRENT_MAJOR_VERSION);
|
||||
|
||||
memcpy(mCompleteCode + offset, mStates->mCodeChunk, mStates->mCurrentOffset); /*Flawfinder: ignore*/
|
||||
offset += mStates->mCurrentOffset;
|
||||
|
||||
set_register(mCompleteCode, LREG_HR, offset);
|
||||
|
||||
memcpy(mCompleteCode + offset, mHeap->mCodeChunk, mHeap->mCurrentOffset); /*Flawfinder: ignore*/
|
||||
offset += mHeap->mCurrentOffset;
|
||||
|
||||
set_register(mCompleteCode, LREG_HP, offset);
|
||||
set_register(mCompleteCode, LREG_FR, 0);
|
||||
set_register(mCompleteCode, LREG_SLR, 0);
|
||||
set_register(mCompleteCode, LREG_ESR, 0);
|
||||
set_register(mCompleteCode, LREG_PR, 0);
|
||||
set_register(mCompleteCode, LREG_TM, mTotalSize);
|
||||
|
||||
|
||||
if (fwrite(mCompleteCode, 1, mTotalSize, bcfp) != mTotalSize)
|
||||
{
|
||||
llwarns << "Short write" << llendl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gErrorToText.writeError(efp, 0, 0, LSERROR_ASSEMBLE_OUT_OF_MEMORY);
|
||||
}
|
||||
}
|
||||
|
||||
LLScriptScriptCodeChunk *gScriptCodeChunk;
|
||||
95
indra/lscript/lscript_compile/lscript_bytecode.h
Normal file
95
indra/lscript/lscript_compile/lscript_bytecode.h
Normal file
@@ -0,0 +1,95 @@
|
||||
/**
|
||||
* @file lscript_bytecode.h
|
||||
* @brief classes to build actual bytecode
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2009, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_LSCRIPT_BYTECODE_H
|
||||
#define LL_LSCRIPT_BYTECODE_H
|
||||
|
||||
#include "lscript_byteconvert.h"
|
||||
#include "lscript_scope.h"
|
||||
|
||||
class LLScriptJumpTable
|
||||
{
|
||||
public:
|
||||
LLScriptJumpTable();
|
||||
~LLScriptJumpTable();
|
||||
|
||||
void addLabel(char *name, S32 offset);
|
||||
void addJump(char *name, S32 offset);
|
||||
|
||||
LLMap<char *, S32 *> mLabelMap;
|
||||
LLMap<char *, S32 *> mJumpMap;
|
||||
};
|
||||
|
||||
class LLScriptByteCodeChunk
|
||||
{
|
||||
public:
|
||||
LLScriptByteCodeChunk(BOOL b_need_jumps);
|
||||
~LLScriptByteCodeChunk();
|
||||
|
||||
void addByte(U8 byte);
|
||||
void addU16(U16 data);
|
||||
void addBytes(const U8 *bytes, S32 size);
|
||||
void addBytes(const char *bytes, S32 size);
|
||||
void addBytes(S32 size);
|
||||
void addBytesDontInc(S32 size);
|
||||
void addInteger(S32 value);
|
||||
void addFloat(F32 value);
|
||||
void addLabel(char *name);
|
||||
void addJump(char *name);
|
||||
void connectJumps();
|
||||
|
||||
U8 *mCodeChunk;
|
||||
S32 mCurrentOffset;
|
||||
LLScriptJumpTable *mJumpTable;
|
||||
};
|
||||
|
||||
class LLScriptScriptCodeChunk
|
||||
{
|
||||
public:
|
||||
LLScriptScriptCodeChunk(S32 total_size);
|
||||
~LLScriptScriptCodeChunk();
|
||||
|
||||
void build(LLFILE *efp, LLFILE *bcfp);
|
||||
|
||||
LLScriptByteCodeChunk *mRegisters;
|
||||
LLScriptByteCodeChunk *mGlobalVariables;
|
||||
LLScriptByteCodeChunk *mGlobalFunctions;
|
||||
LLScriptByteCodeChunk *mStates;
|
||||
LLScriptByteCodeChunk *mHeap;
|
||||
S32 mTotalSize;
|
||||
U8 *mCompleteCode;
|
||||
};
|
||||
|
||||
extern LLScriptScriptCodeChunk *gScriptCodeChunk;
|
||||
|
||||
#endif
|
||||
|
||||
109
indra/lscript/lscript_compile/lscript_error.cpp
Normal file
109
indra/lscript/lscript_compile/lscript_error.cpp
Normal file
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
* @file lscript_error.cpp
|
||||
* @brief error reporting class and strings
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2009, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "lscript_error.h"
|
||||
|
||||
S32 gColumn = 0;
|
||||
S32 gLine = 0;
|
||||
S32 gInternalColumn = 0;
|
||||
S32 gInternalLine = 0;
|
||||
|
||||
LLScriptGenerateErrorText gErrorToText;
|
||||
|
||||
void LLScriptFilePosition::fdotabs(LLFILE *fp, S32 tabs, S32 tabsize)
|
||||
{
|
||||
S32 i;
|
||||
for (i = 0; i < tabs * tabsize; i++)
|
||||
{
|
||||
fprintf(fp, " ");
|
||||
}
|
||||
}
|
||||
|
||||
const char* gWarningText[LSWARN_EOF] = /*Flawfinder: ignore*/
|
||||
{
|
||||
"INVALID",
|
||||
"Dead code found beyond return statement"
|
||||
};
|
||||
|
||||
const char* gErrorText[LSERROR_EOF] = /*Flawfinder: ignore*/
|
||||
{
|
||||
"INVALID",
|
||||
"Syntax error",
|
||||
"Not all code paths return a value",
|
||||
"Function returns a value but return statement doesn't",
|
||||
"Return statement type doesn't match function return type",
|
||||
"Global functions can't change state",
|
||||
"Name previously declared within scope",
|
||||
"Name not defined within scope",
|
||||
"Type mismatch",
|
||||
"Expression must act on LValue",
|
||||
"Byte code assembly failed -- out of memory",
|
||||
"Function call mismatches type or number of arguments",
|
||||
"Use of vector or quaternion method on incorrect type",
|
||||
"Lists can't be included in lists",
|
||||
"Unitialized variables can't be included in lists",
|
||||
"Declaration requires a new scope -- use { and }",
|
||||
"CIL assembler failed",
|
||||
"Bytecode transformer failed",
|
||||
"Bytecode verification failed"
|
||||
};
|
||||
|
||||
void LLScriptGenerateErrorText::writeWarning(LLFILE *fp, LLScriptFilePosition *pos, LSCRIPTWarnings warning)
|
||||
{
|
||||
fprintf(fp, "(%d, %d) : WARNING : %s\n", pos->mLineNumber, pos->mColumnNumber, gWarningText[warning]);
|
||||
mTotalWarnings++;
|
||||
}
|
||||
|
||||
void LLScriptGenerateErrorText::writeWarning(LLFILE *fp, S32 line, S32 col, LSCRIPTWarnings warning)
|
||||
{
|
||||
fprintf(fp, "(%d, %d) : WARNING : %s\n", line, col, gWarningText[warning]);
|
||||
mTotalWarnings++;
|
||||
}
|
||||
|
||||
void LLScriptGenerateErrorText::writeError(LLFILE *fp, LLScriptFilePosition *pos, LSCRIPTErrors error)
|
||||
{
|
||||
fprintf(fp, "(%d, %d) : ERROR : %s\n", pos->mLineNumber, pos->mColumnNumber, gErrorText[error]);
|
||||
mTotalErrors++;
|
||||
}
|
||||
|
||||
void LLScriptGenerateErrorText::writeError(LLFILE *fp, S32 line, S32 col, LSCRIPTErrors error)
|
||||
{
|
||||
fprintf(fp, "(%d, %d) : ERROR : %s\n", line, col, gErrorText[error]);
|
||||
mTotalErrors++;
|
||||
}
|
||||
|
||||
std::string getLScriptErrorString(LSCRIPTErrors error)
|
||||
{
|
||||
return gErrorText[error];
|
||||
}
|
||||
158
indra/lscript/lscript_compile/lscript_error.h
Normal file
158
indra/lscript/lscript_compile/lscript_error.h
Normal file
@@ -0,0 +1,158 @@
|
||||
/**
|
||||
* @file lscript_error.h
|
||||
* @brief error reporting class and strings
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2009, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_LSCRIPT_ERROR_H
|
||||
#define LL_LSCRIPT_ERROR_H
|
||||
|
||||
#include "lscript_scope.h"
|
||||
|
||||
typedef enum e_lscript_compile_pass
|
||||
{
|
||||
LSCP_INVALID,
|
||||
LSCP_PRETTY_PRINT,
|
||||
LSCP_PRUNE,
|
||||
LSCP_SCOPE_PASS1,
|
||||
LSCP_SCOPE_PASS2,
|
||||
LSCP_TYPE,
|
||||
LSCP_RESOURCE,
|
||||
LSCP_EMIT_ASSEMBLY,
|
||||
LSCP_EMIT_BYTE_CODE,
|
||||
LSCP_DETERMINE_HANDLERS,
|
||||
LSCP_LIST_BUILD_SIMPLE,
|
||||
LSCP_TO_STACK,
|
||||
LSCP_BUILD_FUNCTION_ARGS,
|
||||
LSCP_EMIT_CIL_ASSEMBLY,
|
||||
LSCP_EOF
|
||||
} LSCRIPTCompilePass;
|
||||
|
||||
typedef enum e_lscript_prune_type
|
||||
{
|
||||
LSPRUNE_INVALID,
|
||||
LSPRUNE_GLOBAL_VOIDS,
|
||||
LSPRUNE_GLOBAL_NON_VOIDS,
|
||||
LSPRUNE_EVENTS,
|
||||
LSPRUNE_DEAD_CODE,
|
||||
LSPRUNE_EOF
|
||||
} LSCRIPTPruneType;
|
||||
|
||||
extern S32 gColumn;
|
||||
extern S32 gLine;
|
||||
extern S32 gInternalColumn;
|
||||
extern S32 gInternalLine;
|
||||
|
||||
|
||||
// used to describe where in the file this piece is
|
||||
class LLScriptByteCodeChunk;
|
||||
|
||||
class LLScriptLibData;
|
||||
|
||||
class LLScriptFilePosition
|
||||
{
|
||||
public:
|
||||
LLScriptFilePosition(S32 line, S32 col)
|
||||
: mLineNumber(line), mColumnNumber(col), mByteOffset(0), mByteSize(0)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~LLScriptFilePosition() {}
|
||||
|
||||
virtual void recurse(LLFILE *fp, S32 tabs, S32 tabsize,
|
||||
LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg,
|
||||
LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count,
|
||||
LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) = 0;
|
||||
virtual S32 getSize() = 0;
|
||||
|
||||
void fdotabs(LLFILE *fp, S32 tabs, S32 tabsize);
|
||||
|
||||
S32 mLineNumber;
|
||||
S32 mColumnNumber;
|
||||
|
||||
S32 mByteOffset;
|
||||
S32 mByteSize;
|
||||
};
|
||||
|
||||
typedef enum e_lscript_warnings
|
||||
{
|
||||
LSWARN_INVALID,
|
||||
LSWARN_DEAD_CODE,
|
||||
LSWARN_EOF
|
||||
} LSCRIPTWarnings;
|
||||
|
||||
typedef enum e_lscript_errors
|
||||
{
|
||||
LSERROR_INVALID,
|
||||
LSERROR_SYNTAX_ERROR,
|
||||
LSERROR_NO_RETURN,
|
||||
LSERROR_INVALID_VOID_RETURN,
|
||||
LSERROR_INVALID_RETURN,
|
||||
LSERROR_STATE_CHANGE_IN_GLOBAL,
|
||||
LSERROR_DUPLICATE_NAME,
|
||||
LSERROR_UNDEFINED_NAME,
|
||||
LSERROR_TYPE_MISMATCH,
|
||||
LSERROR_EXPRESSION_ON_LVALUE,
|
||||
LSERROR_ASSEMBLE_OUT_OF_MEMORY,
|
||||
LSERROR_FUNCTION_TYPE_ERROR,
|
||||
LSERROR_VECTOR_METHOD_ERROR,
|
||||
LSERROR_NO_LISTS_IN_LISTS,
|
||||
LSERROR_NO_UNITIALIZED_VARIABLES_IN_LISTS,
|
||||
LSERROR_NEED_NEW_SCOPE,
|
||||
LSERROR_CIL_ASSEMBLER_FAILED = 16, // Mono build error.
|
||||
LSERROR_BYTECODE_TRANSFORM_FAILED = 17, // Mono build error.
|
||||
LSERROR_BYTECODE_VERIFICATION_FAILED, // Mono build error.
|
||||
LSERROR_EOF
|
||||
} LSCRIPTErrors;
|
||||
|
||||
class LLScriptGenerateErrorText
|
||||
{
|
||||
public:
|
||||
LLScriptGenerateErrorText() { init(); }
|
||||
~LLScriptGenerateErrorText() {}
|
||||
|
||||
void init() { mTotalErrors = 0; mTotalWarnings = 0; }
|
||||
|
||||
void writeWarning(LLFILE *fp, LLScriptFilePosition *pos, LSCRIPTWarnings warning);
|
||||
void writeWarning(LLFILE *fp, S32 line, S32 col, LSCRIPTWarnings warning);
|
||||
void writeError(LLFILE *fp, LLScriptFilePosition *pos, LSCRIPTErrors error);
|
||||
void writeError(LLFILE *fp, S32 line, S32 col, LSCRIPTErrors error);
|
||||
|
||||
BOOL getErrors() { return mTotalErrors; }
|
||||
BOOL getWarnings() { return mTotalWarnings; }
|
||||
|
||||
S32 mTotalErrors;
|
||||
S32 mTotalWarnings;
|
||||
};
|
||||
|
||||
std::string getLScriptErrorString(LSCRIPTErrors error);
|
||||
|
||||
extern LLScriptGenerateErrorText gErrorToText;
|
||||
|
||||
#endif
|
||||
73
indra/lscript/lscript_compile/lscript_heap.cpp
Normal file
73
indra/lscript/lscript_compile/lscript_heap.cpp
Normal file
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* @file lscript_heap.cpp
|
||||
* @brief classes to manage script heap
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2009, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#if 0
|
||||
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "lscript_heap.h"
|
||||
|
||||
LLScriptHeapEntry::LLScriptHeapEntry(U8 *entry)
|
||||
: mEntry(entry)
|
||||
{
|
||||
S32 offset = 0;
|
||||
mNext = bytestream2integer(entry, offset);
|
||||
mRefCount = bytestream2integer(entry, offset);
|
||||
mType = *(entry + offset);
|
||||
mData = entry + offset;
|
||||
mListOffset = offset;
|
||||
}
|
||||
|
||||
LLScriptHeapEntry::LLScriptHeapEntry(U8 *heap, S32 offset)
|
||||
: mNext(0x9), mType(0), mRefCount(0), mEntry(heap + offset), mData(heap + offset + 0x9), mListOffset(0x9)
|
||||
{
|
||||
}
|
||||
|
||||
LLScriptHeapEntry::~LLScriptHeapEntry()
|
||||
{
|
||||
}
|
||||
|
||||
void LLScriptHeapEntry::addString(char *string)
|
||||
{
|
||||
S32 size = strlen(string) + 1; /*Flawfinder: ignore*/
|
||||
S32 offset = 0;
|
||||
memcpy(mData, string, size); /*Flawfinder: ignore*/
|
||||
mNext += size;
|
||||
integer2bytestream(mEntry, offset, mNext);
|
||||
mRefCount++;
|
||||
integer2bytestream(mEntry, offset, mRefCount);
|
||||
*(mEntry + offset) = LSCRIPTTypeByte[LST_STRING];
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
64
indra/lscript/lscript_compile/lscript_heap.h
Normal file
64
indra/lscript/lscript_compile/lscript_heap.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* @file lscript_heap.h
|
||||
* @brief classes to manage script heap
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2009, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#if 0
|
||||
|
||||
#ifndef LL_LSCRIPT_HEAP_H
|
||||
#define LL_LSCRIPT_HEAP_H
|
||||
|
||||
#include "lscript_byteconvert.h"
|
||||
//#include "vmath.h"
|
||||
#include "v3math.h"
|
||||
#include "llquaternion.h"
|
||||
|
||||
class LLScriptHeapEntry
|
||||
{
|
||||
public:
|
||||
LLScriptHeapEntry(U8 *entry);
|
||||
LLScriptHeapEntry(U8 *heap, S32 offset);
|
||||
~LLScriptHeapEntry();
|
||||
|
||||
void addString(char *string);
|
||||
|
||||
S32 mNext;
|
||||
U8 mType;
|
||||
S32 mRefCount;
|
||||
S32 mListOffset;
|
||||
U8 *mEntry;
|
||||
U8 *mData;
|
||||
U8 *mListEntry;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
42
indra/lscript/lscript_compile/lscript_resource.cpp
Normal file
42
indra/lscript/lscript_compile/lscript_resource.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* @file lscript_resource.cpp
|
||||
* @brief resource determination prior to assembly
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2009, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "lscript_resource.h"
|
||||
|
||||
void init_temp_jumps()
|
||||
{
|
||||
gTempJumpCount = 0;
|
||||
}
|
||||
|
||||
S32 gTempJumpCount = 0;
|
||||
43
indra/lscript/lscript_compile/lscript_resource.h
Normal file
43
indra/lscript/lscript_compile/lscript_resource.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* @file lscript_resource.h
|
||||
* @brief resource determination prior to assembly
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2009, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_LSCRIPT_RESOURCE_H
|
||||
#define LL_LSCRIPT_RESOURCE_H
|
||||
|
||||
#include "lscript_scope.h"
|
||||
|
||||
void init_temp_jumps();
|
||||
|
||||
extern S32 gTempJumpCount;
|
||||
|
||||
#endif
|
||||
|
||||
37
indra/lscript/lscript_compile/lscript_scope.cpp
Normal file
37
indra/lscript/lscript_compile/lscript_scope.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @file lscript_scope.cpp
|
||||
* @brief builds nametable and checks scope
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2009, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "lscript_tree.h"
|
||||
|
||||
LLStringTable *gScopeStringTable;
|
||||
412
indra/lscript/lscript_compile/lscript_scope.h
Normal file
412
indra/lscript/lscript_compile/lscript_scope.h
Normal file
@@ -0,0 +1,412 @@
|
||||
/**
|
||||
* @file lscript_scope.h
|
||||
* @brief builds nametable and checks scope
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2009, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_LSCRIPT_SCOPE_H
|
||||
#define LL_LSCRIPT_SCOPE_H
|
||||
|
||||
#include "string_table.h"
|
||||
#include "llmap.h"
|
||||
#include "lscript_byteformat.h"
|
||||
|
||||
typedef enum e_lscript_identifier_type
|
||||
{
|
||||
LIT_INVALID,
|
||||
LIT_GLOBAL,
|
||||
LIT_VARIABLE,
|
||||
LIT_FUNCTION,
|
||||
LIT_LABEL,
|
||||
LIT_STATE,
|
||||
LIT_HANDLER,
|
||||
LIT_LIBRARY_FUNCTION,
|
||||
LIT_EOF
|
||||
} LSCRIPTIdentifierType;
|
||||
|
||||
const char LSCRIPTFunctionTypeStrings[LST_EOF] = /*Flawfinder: ignore*/
|
||||
{
|
||||
'0',
|
||||
'i',
|
||||
'f',
|
||||
's',
|
||||
'k',
|
||||
'v',
|
||||
'q',
|
||||
'l',
|
||||
'0'
|
||||
};
|
||||
|
||||
const char * const LSCRIPTListDescription[LST_EOF] = /*Flawfinder: ignore*/
|
||||
{
|
||||
"PUSHARGB 0",
|
||||
"PUSHARGB 1",
|
||||
"PUSHARGB 2",
|
||||
"PUSHARGB 3",
|
||||
"PUSHARGB 4",
|
||||
"PUSHARGB 5",
|
||||
"PUSHARGB 6",
|
||||
"PUSHARGB 7",
|
||||
"PUSHARGB 0"
|
||||
};
|
||||
|
||||
const char * const LSCRIPTTypePush[LST_EOF] = /*Flawfinder: ignore*/
|
||||
{
|
||||
"INVALID",
|
||||
"PUSHE",
|
||||
"PUSHE",
|
||||
"PUSHE",
|
||||
"PUSHE",
|
||||
"PUSHEV",
|
||||
"PUSHEQ",
|
||||
"PUSHE",
|
||||
"undefined"
|
||||
};
|
||||
|
||||
const char * const LSCRIPTTypeReturn[LST_EOF] = /*Flawfinder: ignore*/
|
||||
{
|
||||
"INVALID",
|
||||
"LOADP -12",
|
||||
"LOADP -12",
|
||||
"STORES -12\nPOP",
|
||||
"STORES -12\nPOP",
|
||||
"LOADVP -20",
|
||||
"LOADQP -24",
|
||||
"LOADLP -12",
|
||||
"undefined"
|
||||
};
|
||||
|
||||
const char * const LSCRIPTTypePop[LST_EOF] = /*Flawfinder: ignore*/
|
||||
{
|
||||
"INVALID",
|
||||
"POP",
|
||||
"POP",
|
||||
"POPS",
|
||||
"POPS",
|
||||
"POPV",
|
||||
"POPQ",
|
||||
"POPL",
|
||||
"undefined"
|
||||
};
|
||||
|
||||
const char * const LSCRIPTTypeDuplicate[LST_EOF] = /*Flawfinder: ignore*/
|
||||
{
|
||||
"INVALID",
|
||||
"DUP",
|
||||
"DUP",
|
||||
"DUPS",
|
||||
"DUPS",
|
||||
"DUPV",
|
||||
"DUPQ",
|
||||
"DUPL",
|
||||
"undefined"
|
||||
};
|
||||
|
||||
const char * const LSCRIPTTypeLocalStore[LST_EOF] = /*Flawfinder: ignore*/
|
||||
{
|
||||
"INVALID",
|
||||
"STORE ",
|
||||
"STORE ",
|
||||
"STORES ",
|
||||
"STORES ",
|
||||
"STOREV ",
|
||||
"STOREQ ",
|
||||
"STOREL ",
|
||||
"undefined"
|
||||
};
|
||||
|
||||
const char * const LSCRIPTTypeLocalDeclaration[LST_EOF] = /*Flawfinder: ignore*/
|
||||
{
|
||||
"INVALID",
|
||||
"STOREP ",
|
||||
"STOREP ",
|
||||
"STORESP ",
|
||||
"STORESP ",
|
||||
"STOREVP ",
|
||||
"STOREQP ",
|
||||
"STORELP ",
|
||||
"undefined"
|
||||
};
|
||||
|
||||
const char * const LSCRIPTTypeGlobalStore[LST_EOF] = /*Flawfinder: ignore*/
|
||||
{
|
||||
"INVALID",
|
||||
"STOREG ",
|
||||
"STOREG ",
|
||||
"STORESG ",
|
||||
"STORESG ",
|
||||
"STOREGV ",
|
||||
"STOREGQ ",
|
||||
"STORELG ",
|
||||
"undefined"
|
||||
};
|
||||
|
||||
const char * const LSCRIPTTypeLocalPush[LST_EOF] = /*Flawfinder: ignore*/
|
||||
{
|
||||
"INVALID",
|
||||
"PUSH ",
|
||||
"PUSH ",
|
||||
"PUSHS ",
|
||||
"PUSHS ",
|
||||
"PUSHV ",
|
||||
"PUSHQ ",
|
||||
"PUSHL ",
|
||||
"undefined"
|
||||
};
|
||||
|
||||
const char * const LSCRIPTTypeLocalPush1[LST_EOF] = /*Flawfinder: ignore*/
|
||||
{
|
||||
"INVALID",
|
||||
"PUSHARGI 1",
|
||||
"PUSHARGF 1",
|
||||
"undefined",
|
||||
"undefined",
|
||||
"undefined",
|
||||
"undefined",
|
||||
"undefined",
|
||||
"undefined"
|
||||
};
|
||||
|
||||
const char * const LSCRIPTTypeGlobalPush[LST_EOF] = /*Flawfinder: ignore*/
|
||||
{
|
||||
"INVALID",
|
||||
"PUSHG ",
|
||||
"PUSHG ",
|
||||
"PUSHGS ",
|
||||
"PUSHGS ",
|
||||
"PUSHGV ",
|
||||
"PUSHGQ ",
|
||||
"PUSHGL ",
|
||||
"undefined"
|
||||
};
|
||||
|
||||
class LLScriptSimpleAssignable;
|
||||
|
||||
class LLScriptArgString
|
||||
{
|
||||
public:
|
||||
LLScriptArgString() : mString(NULL) {}
|
||||
~LLScriptArgString() { delete [] mString; }
|
||||
|
||||
LSCRIPTType getType(S32 count)
|
||||
{
|
||||
if (!mString)
|
||||
return LST_NULL;
|
||||
S32 length = (S32)strlen(mString); /*Flawfinder: ignore*/
|
||||
if (count >= length)
|
||||
{
|
||||
return LST_NULL;
|
||||
}
|
||||
switch(mString[count])
|
||||
{
|
||||
case 'i':
|
||||
return LST_INTEGER;
|
||||
case 'f':
|
||||
return LST_FLOATINGPOINT;
|
||||
case 's':
|
||||
return LST_STRING;
|
||||
case 'k':
|
||||
return LST_KEY;
|
||||
case 'v':
|
||||
return LST_VECTOR;
|
||||
case 'q':
|
||||
return LST_QUATERNION;
|
||||
case 'l':
|
||||
return LST_LIST;
|
||||
default:
|
||||
return LST_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void addType(LSCRIPTType type)
|
||||
{
|
||||
S32 count = 0;
|
||||
if (mString)
|
||||
{
|
||||
count = (S32)strlen(mString); /*Flawfinder: ignore*/
|
||||
char *temp = new char[count + 2];
|
||||
memcpy(temp, mString, count); /*Flawfinder: ignore*/
|
||||
delete [] mString;
|
||||
mString = temp;
|
||||
mString[count + 1] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
mString = new char[count + 2];
|
||||
mString[count + 1] = 0;
|
||||
}
|
||||
mString[count++] = LSCRIPTFunctionTypeStrings[type];
|
||||
}
|
||||
|
||||
S32 getNumber()
|
||||
{
|
||||
if (mString)
|
||||
return (S32)strlen(mString); /*Flawfinder: ignore*/
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *mString;
|
||||
};
|
||||
|
||||
class LLScriptScopeEntry
|
||||
{
|
||||
public:
|
||||
LLScriptScopeEntry(const char *identifier, LSCRIPTIdentifierType idtype, LSCRIPTType type, S32 count = 0)
|
||||
: mIdentifier(identifier), mIDType(idtype), mType(type), mOffset(0), mSize(0), mAssignable(NULL), mCount(count), mLibraryNumber(0)
|
||||
{
|
||||
}
|
||||
|
||||
~LLScriptScopeEntry() {}
|
||||
|
||||
const char *mIdentifier;
|
||||
LSCRIPTIdentifierType mIDType;
|
||||
LSCRIPTType mType;
|
||||
S32 mOffset;
|
||||
S32 mSize;
|
||||
LLScriptSimpleAssignable *mAssignable;
|
||||
S32 mCount; // NOTE: Index for locals in CIL.
|
||||
U16 mLibraryNumber;
|
||||
LLScriptArgString mFunctionArgs;
|
||||
LLScriptArgString mLocals;
|
||||
};
|
||||
|
||||
class LLScriptScope
|
||||
{
|
||||
public:
|
||||
LLScriptScope(LLStringTable *stable)
|
||||
: mParentScope(NULL), mSTable(stable), mFunctionCount(0), mStateCount(0)
|
||||
{
|
||||
}
|
||||
|
||||
~LLScriptScope()
|
||||
{
|
||||
mEntryMap.deleteAllData();
|
||||
}
|
||||
|
||||
LLScriptScopeEntry *addEntry(const char *identifier, LSCRIPTIdentifierType idtype, LSCRIPTType type)
|
||||
{
|
||||
const char *name = mSTable->addString(identifier);
|
||||
if (!mEntryMap.checkData(name))
|
||||
{
|
||||
if (idtype == LIT_FUNCTION)
|
||||
mEntryMap[name] = new LLScriptScopeEntry(name, idtype, type, mFunctionCount++);
|
||||
else if (idtype == LIT_STATE)
|
||||
mEntryMap[name] = new LLScriptScopeEntry(name, idtype, type, mStateCount++);
|
||||
else
|
||||
mEntryMap[name] = new LLScriptScopeEntry(name, idtype, type);
|
||||
return mEntryMap[name];
|
||||
}
|
||||
else
|
||||
{
|
||||
// identifier already exists at this scope
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL checkEntry(const char *identifier)
|
||||
{
|
||||
const char *name = mSTable->addString(identifier);
|
||||
if (mEntryMap.checkData(name))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// identifier already exists at this scope
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
LLScriptScopeEntry *findEntry(const char *identifier)
|
||||
{
|
||||
const char *name = mSTable->addString(identifier);
|
||||
LLScriptScope *scope = this;
|
||||
|
||||
while (scope)
|
||||
{
|
||||
if (scope->mEntryMap.checkData(name))
|
||||
{
|
||||
// cool, we found it at this scope
|
||||
return scope->mEntryMap[name];
|
||||
}
|
||||
scope = scope->mParentScope;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
LLScriptScopeEntry *findEntryTyped(const char *identifier, LSCRIPTIdentifierType idtype)
|
||||
{
|
||||
const char *name = mSTable->addString(identifier);
|
||||
LLScriptScope *scope = this;
|
||||
|
||||
while (scope)
|
||||
{
|
||||
if (scope->mEntryMap.checkData(name))
|
||||
{
|
||||
// need to check type, and if type is function we need to check both types
|
||||
if (idtype == LIT_FUNCTION)
|
||||
{
|
||||
if (scope->mEntryMap[name]->mIDType == LIT_FUNCTION)
|
||||
{
|
||||
return scope->mEntryMap[name];
|
||||
}
|
||||
else if (scope->mEntryMap[name]->mIDType == LIT_LIBRARY_FUNCTION)
|
||||
{
|
||||
return scope->mEntryMap[name];
|
||||
}
|
||||
}
|
||||
else if (scope->mEntryMap[name]->mIDType == idtype)
|
||||
{
|
||||
// cool, we found it at this scope
|
||||
return scope->mEntryMap[name];
|
||||
}
|
||||
}
|
||||
scope = scope->mParentScope;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void addParentScope(LLScriptScope *scope)
|
||||
{
|
||||
mParentScope = scope;
|
||||
}
|
||||
|
||||
LLMap<const char *, LLScriptScopeEntry *> mEntryMap;
|
||||
LLScriptScope *mParentScope;
|
||||
LLStringTable *mSTable;
|
||||
S32 mFunctionCount;
|
||||
S32 mStateCount;
|
||||
};
|
||||
|
||||
extern LLStringTable *gScopeStringTable;
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
10892
indra/lscript/lscript_compile/lscript_tree.cpp
Normal file
10892
indra/lscript/lscript_compile/lscript_tree.cpp
Normal file
File diff suppressed because it is too large
Load Diff
2331
indra/lscript/lscript_compile/lscript_tree.h
Normal file
2331
indra/lscript/lscript_compile/lscript_tree.h
Normal file
File diff suppressed because it is too large
Load Diff
592
indra/lscript/lscript_compile/lscript_typecheck.cpp
Normal file
592
indra/lscript/lscript_compile/lscript_typecheck.cpp
Normal file
@@ -0,0 +1,592 @@
|
||||
/**
|
||||
* @file lscript_typecheck.cpp
|
||||
* @brief typechecks script
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2009, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "lscript_tree.h"
|
||||
|
||||
/*
|
||||
LScript automatic type casting
|
||||
|
||||
LST_INTEGER -> LST_INTEGER
|
||||
|
||||
LST_FLOATINGPOINT -> LST_FLOATINGPOINT
|
||||
LST_INTEGER -> LST_FLOATINGPOINT
|
||||
|
||||
LST_FLOATINGPOINT -> LST_STRING
|
||||
LST_INTEGER -> LST_STRING
|
||||
LST_STRING -> LST_STRING
|
||||
LST_VECTOR -> LST_STRING
|
||||
LST_QUATERNION -> LST_STRING
|
||||
LST_LIST -> LST_STRING
|
||||
|
||||
LST_VECTOR -> LST_VECTOR
|
||||
|
||||
LST_QUATERNION -> LST_QUATERNION
|
||||
|
||||
LST_FLOATINGPOINT -> LST_LIST
|
||||
LST_INTEGER -> LST_LIST
|
||||
LST_STRING -> LST_LIST
|
||||
LST_VECTOR -> LST_LIST
|
||||
LST_QUATERNION -> LST_LIST
|
||||
LST_LIST -> LST_LIST
|
||||
*/
|
||||
|
||||
LSCRIPTType implicit_casts(LSCRIPTType left_side, LSCRIPTType right_side)
|
||||
{
|
||||
switch(left_side)
|
||||
{
|
||||
// shouldn't be doing an operation on void types
|
||||
case LST_NULL:
|
||||
switch(right_side)
|
||||
{
|
||||
case LST_NULL:
|
||||
return LST_NULL;
|
||||
default:
|
||||
return LST_UNDEFINED;
|
||||
}
|
||||
// shouldn't be doing an operation on undefined types
|
||||
case LST_UNDEFINED:
|
||||
return LST_UNDEFINED;
|
||||
// only integers can become integers
|
||||
case LST_INTEGER:
|
||||
switch(right_side)
|
||||
{
|
||||
case LST_INTEGER:
|
||||
return LST_INTEGER;
|
||||
default:
|
||||
return LST_UNDEFINED;
|
||||
}
|
||||
// only integers and floats can become floats
|
||||
case LST_FLOATINGPOINT:
|
||||
switch(right_side)
|
||||
{
|
||||
case LST_INTEGER:
|
||||
case LST_FLOATINGPOINT:
|
||||
return LST_FLOATINGPOINT;
|
||||
default:
|
||||
return LST_UNDEFINED;
|
||||
}
|
||||
// only strings and keys can become strings
|
||||
case LST_STRING:
|
||||
switch(right_side)
|
||||
{
|
||||
case LST_STRING:
|
||||
case LST_KEY:
|
||||
return LST_STRING;
|
||||
default:
|
||||
return LST_UNDEFINED;
|
||||
}
|
||||
// only strings and keys can become keys
|
||||
case LST_KEY:
|
||||
switch(right_side)
|
||||
{
|
||||
case LST_STRING:
|
||||
case LST_KEY:
|
||||
return LST_KEY;
|
||||
default:
|
||||
return LST_UNDEFINED;
|
||||
}
|
||||
// only vectors can become vectors
|
||||
case LST_VECTOR:
|
||||
switch(right_side)
|
||||
{
|
||||
case LST_VECTOR:
|
||||
return LST_VECTOR;
|
||||
default:
|
||||
return LST_UNDEFINED;
|
||||
}
|
||||
// only quaternions can become quaternions
|
||||
case LST_QUATERNION:
|
||||
switch(right_side)
|
||||
{
|
||||
case LST_QUATERNION:
|
||||
return LST_QUATERNION;
|
||||
default:
|
||||
return LST_UNDEFINED;
|
||||
}
|
||||
// only lists can become lists
|
||||
case LST_LIST:
|
||||
switch(right_side)
|
||||
{
|
||||
case LST_LIST:
|
||||
return LST_LIST;
|
||||
default:
|
||||
return LST_UNDEFINED;
|
||||
}
|
||||
default:
|
||||
return LST_UNDEFINED;
|
||||
}
|
||||
}
|
||||
|
||||
LSCRIPTType promote(LSCRIPTType left_side, LSCRIPTType right_side)
|
||||
{
|
||||
LSCRIPTType type;
|
||||
type = implicit_casts(left_side, right_side);
|
||||
if (type != LST_UNDEFINED)
|
||||
{
|
||||
return type;
|
||||
}
|
||||
type = implicit_casts(right_side, left_side);
|
||||
if (type != LST_UNDEFINED)
|
||||
{
|
||||
return type;
|
||||
}
|
||||
return LST_UNDEFINED;
|
||||
}
|
||||
|
||||
BOOL legal_assignment(LSCRIPTType left_side, LSCRIPTType right_side)
|
||||
{
|
||||
// this is to prevent cascading errors
|
||||
if ( (left_side == LST_UNDEFINED)
|
||||
||(right_side == LST_UNDEFINED))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (implicit_casts(left_side, right_side) != LST_UNDEFINED)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL legal_casts(LSCRIPTType cast, LSCRIPTType base)
|
||||
{
|
||||
switch(base)
|
||||
{
|
||||
// shouldn't be doing an operation on void types
|
||||
case LST_NULL:
|
||||
return FALSE;
|
||||
// shouldn't be doing an operation on undefined types
|
||||
case LST_UNDEFINED:
|
||||
return FALSE;
|
||||
case LST_INTEGER:
|
||||
switch(cast)
|
||||
{
|
||||
case LST_INTEGER:
|
||||
case LST_FLOATINGPOINT:
|
||||
case LST_STRING:
|
||||
case LST_LIST:
|
||||
return TRUE;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case LST_FLOATINGPOINT:
|
||||
switch(cast)
|
||||
{
|
||||
case LST_INTEGER:
|
||||
case LST_FLOATINGPOINT:
|
||||
case LST_STRING:
|
||||
case LST_LIST:
|
||||
return TRUE;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case LST_STRING:
|
||||
switch(cast)
|
||||
{
|
||||
case LST_INTEGER:
|
||||
case LST_FLOATINGPOINT:
|
||||
case LST_STRING:
|
||||
case LST_KEY:
|
||||
case LST_VECTOR:
|
||||
case LST_QUATERNION:
|
||||
case LST_LIST:
|
||||
return TRUE;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case LST_KEY:
|
||||
switch(cast)
|
||||
{
|
||||
case LST_STRING:
|
||||
case LST_KEY:
|
||||
case LST_LIST:
|
||||
return TRUE;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case LST_VECTOR:
|
||||
switch(cast)
|
||||
{
|
||||
case LST_VECTOR:
|
||||
case LST_STRING:
|
||||
case LST_LIST:
|
||||
return TRUE;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case LST_QUATERNION:
|
||||
switch(cast)
|
||||
{
|
||||
case LST_QUATERNION:
|
||||
case LST_STRING:
|
||||
case LST_LIST:
|
||||
return TRUE;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
// lists can only be cast to lists and strings
|
||||
case LST_LIST:
|
||||
switch(cast)
|
||||
{
|
||||
case LST_LIST:
|
||||
case LST_STRING:
|
||||
return TRUE;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
LSCRIPTType gSupportedExpressionArray[LET_EOF][LST_EOF][LST_EOF];
|
||||
|
||||
void init_supported_expressions(void)
|
||||
{
|
||||
S32 i, j, k;
|
||||
// zero out, then set the ones that matter
|
||||
for (i = 0; i < LET_EOF; i++)
|
||||
{
|
||||
for (j = 0; j < LST_EOF; j++)
|
||||
{
|
||||
for (k = 0; k < LST_EOF; k++)
|
||||
{
|
||||
gSupportedExpressionArray[i][j][k] = LST_NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// LET_ASSIGNMENT
|
||||
gSupportedExpressionArray[LET_ASSIGNMENT][LST_INTEGER][LST_INTEGER] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_ASSIGNMENT][LST_FLOATINGPOINT][LST_INTEGER] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_ASSIGNMENT][LST_INTEGER][LST_FLOATINGPOINT] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_ASSIGNMENT][LST_FLOATINGPOINT][LST_FLOATINGPOINT] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_ASSIGNMENT][LST_STRING][LST_STRING] = LST_STRING;
|
||||
gSupportedExpressionArray[LET_ASSIGNMENT][LST_KEY][LST_KEY] = LST_KEY;
|
||||
gSupportedExpressionArray[LET_ASSIGNMENT][LST_VECTOR][LST_VECTOR] = LST_VECTOR;
|
||||
gSupportedExpressionArray[LET_ASSIGNMENT][LST_QUATERNION][LST_QUATERNION] = LST_QUATERNION;
|
||||
gSupportedExpressionArray[LET_ASSIGNMENT][LST_LIST][LST_INTEGER] = LST_LIST;
|
||||
gSupportedExpressionArray[LET_ASSIGNMENT][LST_LIST][LST_FLOATINGPOINT] = LST_LIST;
|
||||
gSupportedExpressionArray[LET_ASSIGNMENT][LST_LIST][LST_STRING] = LST_LIST;
|
||||
gSupportedExpressionArray[LET_ASSIGNMENT][LST_LIST][LST_KEY] = LST_LIST;
|
||||
gSupportedExpressionArray[LET_ASSIGNMENT][LST_LIST][LST_VECTOR] = LST_LIST;
|
||||
gSupportedExpressionArray[LET_ASSIGNMENT][LST_LIST][LST_QUATERNION] = LST_LIST;
|
||||
gSupportedExpressionArray[LET_ASSIGNMENT][LST_LIST][LST_LIST] = LST_LIST;
|
||||
|
||||
// LET_ADD_ASSIGN
|
||||
gSupportedExpressionArray[LET_ADD_ASSIGN][LST_INTEGER][LST_INTEGER] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_ADD_ASSIGN][LST_FLOATINGPOINT][LST_INTEGER] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_ADD_ASSIGN][LST_FLOATINGPOINT][LST_FLOATINGPOINT] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_ADD_ASSIGN][LST_STRING][LST_STRING] = LST_STRING;
|
||||
gSupportedExpressionArray[LET_ADD_ASSIGN][LST_VECTOR][LST_VECTOR] = LST_VECTOR;
|
||||
gSupportedExpressionArray[LET_ADD_ASSIGN][LST_QUATERNION][LST_QUATERNION] = LST_QUATERNION;
|
||||
gSupportedExpressionArray[LET_ADD_ASSIGN][LST_LIST][LST_INTEGER] = LST_LIST;
|
||||
gSupportedExpressionArray[LET_ADD_ASSIGN][LST_LIST][LST_FLOATINGPOINT] = LST_LIST;
|
||||
gSupportedExpressionArray[LET_ADD_ASSIGN][LST_LIST][LST_STRING] = LST_LIST;
|
||||
gSupportedExpressionArray[LET_ADD_ASSIGN][LST_LIST][LST_KEY] = LST_LIST;
|
||||
gSupportedExpressionArray[LET_ADD_ASSIGN][LST_LIST][LST_VECTOR] = LST_LIST;
|
||||
gSupportedExpressionArray[LET_ADD_ASSIGN][LST_LIST][LST_QUATERNION] = LST_LIST;
|
||||
gSupportedExpressionArray[LET_ADD_ASSIGN][LST_LIST][LST_LIST] = LST_LIST;
|
||||
|
||||
// LET_SUB_ASSIGN
|
||||
gSupportedExpressionArray[LET_SUB_ASSIGN][LST_INTEGER][LST_INTEGER] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_SUB_ASSIGN][LST_FLOATINGPOINT][LST_INTEGER] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_SUB_ASSIGN][LST_FLOATINGPOINT][LST_FLOATINGPOINT] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_SUB_ASSIGN][LST_VECTOR][LST_VECTOR] = LST_VECTOR;
|
||||
gSupportedExpressionArray[LET_SUB_ASSIGN][LST_QUATERNION][LST_QUATERNION] = LST_QUATERNION;
|
||||
|
||||
// LET_MUL_ASSIGN
|
||||
gSupportedExpressionArray[LET_MUL_ASSIGN][LST_INTEGER][LST_INTEGER] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_MUL_ASSIGN][LST_FLOATINGPOINT][LST_INTEGER] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_MUL_ASSIGN][LST_INTEGER][LST_FLOATINGPOINT] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_MUL_ASSIGN][LST_FLOATINGPOINT][LST_FLOATINGPOINT] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_MUL_ASSIGN][LST_VECTOR][LST_INTEGER] = LST_VECTOR;
|
||||
//gSupportedExpressionArray[LET_MUL_ASSIGN][LST_INTEGER][LST_VECTOR] = LST_VECTOR;
|
||||
gSupportedExpressionArray[LET_MUL_ASSIGN][LST_VECTOR][LST_FLOATINGPOINT] = LST_VECTOR;
|
||||
//gSupportedExpressionArray[LET_MUL_ASSIGN][LST_FLOATINGPOINT][LST_VECTOR] = LST_VECTOR;
|
||||
//gSupportedExpressionArray[LET_MUL_ASSIGN][LST_VECTOR][LST_VECTOR] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_MUL_ASSIGN][LST_VECTOR][LST_QUATERNION] = LST_VECTOR;
|
||||
gSupportedExpressionArray[LET_MUL_ASSIGN][LST_QUATERNION][LST_QUATERNION] = LST_QUATERNION;
|
||||
|
||||
// LET_DIV_ASSIGN
|
||||
gSupportedExpressionArray[LET_DIV_ASSIGN][LST_INTEGER][LST_INTEGER] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_DIV_ASSIGN][LST_FLOATINGPOINT][LST_INTEGER] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_DIV_ASSIGN][LST_FLOATINGPOINT][LST_FLOATINGPOINT] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_DIV_ASSIGN][LST_VECTOR][LST_INTEGER] = LST_VECTOR;
|
||||
gSupportedExpressionArray[LET_DIV_ASSIGN][LST_VECTOR][LST_FLOATINGPOINT] = LST_VECTOR;
|
||||
gSupportedExpressionArray[LET_DIV_ASSIGN][LST_VECTOR][LST_QUATERNION] = LST_VECTOR;
|
||||
gSupportedExpressionArray[LET_DIV_ASSIGN][LST_QUATERNION][LST_QUATERNION] = LST_QUATERNION;
|
||||
|
||||
// LET_MOD_ASSIGN
|
||||
gSupportedExpressionArray[LET_MOD_ASSIGN][LST_INTEGER][LST_INTEGER] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_MOD_ASSIGN][LST_VECTOR][LST_VECTOR] = LST_VECTOR;
|
||||
|
||||
// LET_EQUALITY
|
||||
gSupportedExpressionArray[LET_EQUALITY][LST_INTEGER][LST_INTEGER] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_EQUALITY][LST_INTEGER][LST_FLOATINGPOINT] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_EQUALITY][LST_FLOATINGPOINT][LST_INTEGER] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_EQUALITY][LST_FLOATINGPOINT][LST_FLOATINGPOINT] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_EQUALITY][LST_STRING][LST_STRING] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_EQUALITY][LST_STRING][LST_KEY] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_EQUALITY][LST_KEY][LST_STRING] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_EQUALITY][LST_KEY][LST_KEY] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_EQUALITY][LST_VECTOR][LST_VECTOR] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_EQUALITY][LST_QUATERNION][LST_QUATERNION] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_EQUALITY][LST_LIST][LST_LIST] = LST_INTEGER;
|
||||
|
||||
// LET_NOT_EQUALS
|
||||
gSupportedExpressionArray[LET_NOT_EQUALS][LST_INTEGER][LST_INTEGER] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_NOT_EQUALS][LST_INTEGER][LST_FLOATINGPOINT] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_NOT_EQUALS][LST_FLOATINGPOINT][LST_INTEGER] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_NOT_EQUALS][LST_FLOATINGPOINT][LST_FLOATINGPOINT] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_NOT_EQUALS][LST_STRING][LST_STRING] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_NOT_EQUALS][LST_STRING][LST_KEY] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_NOT_EQUALS][LST_KEY][LST_STRING] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_NOT_EQUALS][LST_KEY][LST_KEY] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_NOT_EQUALS][LST_VECTOR][LST_VECTOR] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_NOT_EQUALS][LST_QUATERNION][LST_QUATERNION] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_NOT_EQUALS][LST_LIST][LST_LIST] = LST_INTEGER;
|
||||
|
||||
// LET_LESS_EQUALS
|
||||
gSupportedExpressionArray[LET_LESS_EQUALS][LST_INTEGER][LST_INTEGER] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_LESS_EQUALS][LST_INTEGER][LST_FLOATINGPOINT] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_LESS_EQUALS][LST_FLOATINGPOINT][LST_INTEGER] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_LESS_EQUALS][LST_FLOATINGPOINT][LST_FLOATINGPOINT] = LST_INTEGER;
|
||||
|
||||
// LET_GREATER_EQUALS
|
||||
gSupportedExpressionArray[LET_GREATER_EQUALS][LST_INTEGER][LST_INTEGER] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_GREATER_EQUALS][LST_INTEGER][LST_FLOATINGPOINT] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_GREATER_EQUALS][LST_FLOATINGPOINT][LST_INTEGER] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_GREATER_EQUALS][LST_FLOATINGPOINT][LST_FLOATINGPOINT] = LST_INTEGER;
|
||||
|
||||
// LET_LESS_THAN
|
||||
gSupportedExpressionArray[LET_LESS_THAN][LST_INTEGER][LST_INTEGER] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_LESS_THAN][LST_INTEGER][LST_FLOATINGPOINT] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_LESS_THAN][LST_FLOATINGPOINT][LST_INTEGER] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_LESS_THAN][LST_FLOATINGPOINT][LST_FLOATINGPOINT] = LST_INTEGER;
|
||||
|
||||
// LET_GREATER_THAN
|
||||
gSupportedExpressionArray[LET_GREATER_THAN][LST_INTEGER][LST_INTEGER] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_GREATER_THAN][LST_INTEGER][LST_FLOATINGPOINT] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_GREATER_THAN][LST_FLOATINGPOINT][LST_INTEGER] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_GREATER_THAN][LST_FLOATINGPOINT][LST_FLOATINGPOINT] = LST_INTEGER;
|
||||
|
||||
// LET_PLUS
|
||||
gSupportedExpressionArray[LET_PLUS][LST_INTEGER][LST_INTEGER] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_PLUS][LST_FLOATINGPOINT][LST_INTEGER] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_PLUS][LST_INTEGER][LST_FLOATINGPOINT] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_PLUS][LST_FLOATINGPOINT][LST_FLOATINGPOINT] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_PLUS][LST_STRING][LST_STRING] = LST_STRING;
|
||||
gSupportedExpressionArray[LET_PLUS][LST_VECTOR][LST_VECTOR] = LST_VECTOR;
|
||||
gSupportedExpressionArray[LET_PLUS][LST_QUATERNION][LST_QUATERNION] = LST_QUATERNION;
|
||||
gSupportedExpressionArray[LET_PLUS][LST_LIST][LST_INTEGER] = LST_LIST;
|
||||
gSupportedExpressionArray[LET_PLUS][LST_LIST][LST_FLOATINGPOINT] = LST_LIST;
|
||||
gSupportedExpressionArray[LET_PLUS][LST_LIST][LST_STRING] = LST_LIST;
|
||||
gSupportedExpressionArray[LET_PLUS][LST_LIST][LST_KEY] = LST_LIST;
|
||||
gSupportedExpressionArray[LET_PLUS][LST_LIST][LST_VECTOR] = LST_LIST;
|
||||
gSupportedExpressionArray[LET_PLUS][LST_LIST][LST_QUATERNION] = LST_LIST;
|
||||
gSupportedExpressionArray[LET_PLUS][LST_INTEGER][LST_LIST] = LST_LIST;
|
||||
gSupportedExpressionArray[LET_PLUS][LST_FLOATINGPOINT][LST_LIST] = LST_LIST;
|
||||
gSupportedExpressionArray[LET_PLUS][LST_STRING][LST_LIST] = LST_LIST;
|
||||
gSupportedExpressionArray[LET_PLUS][LST_KEY][LST_LIST] = LST_LIST;
|
||||
gSupportedExpressionArray[LET_PLUS][LST_VECTOR][LST_LIST] = LST_LIST;
|
||||
gSupportedExpressionArray[LET_PLUS][LST_QUATERNION][LST_LIST] = LST_LIST;
|
||||
gSupportedExpressionArray[LET_PLUS][LST_LIST][LST_LIST] = LST_LIST;
|
||||
|
||||
// LET_MINUS
|
||||
gSupportedExpressionArray[LET_MINUS][LST_INTEGER][LST_INTEGER] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_MINUS][LST_FLOATINGPOINT][LST_INTEGER] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_MINUS][LST_INTEGER][LST_FLOATINGPOINT] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_MINUS][LST_FLOATINGPOINT][LST_FLOATINGPOINT] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_MINUS][LST_VECTOR][LST_VECTOR] = LST_VECTOR;
|
||||
gSupportedExpressionArray[LET_MINUS][LST_QUATERNION][LST_QUATERNION] = LST_QUATERNION;
|
||||
|
||||
// LET_TIMES
|
||||
gSupportedExpressionArray[LET_TIMES][LST_INTEGER][LST_INTEGER] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_TIMES][LST_FLOATINGPOINT][LST_INTEGER] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_TIMES][LST_INTEGER][LST_FLOATINGPOINT] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_TIMES][LST_FLOATINGPOINT][LST_FLOATINGPOINT] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_TIMES][LST_VECTOR][LST_INTEGER] = LST_VECTOR;
|
||||
gSupportedExpressionArray[LET_TIMES][LST_INTEGER][LST_VECTOR] = LST_VECTOR;
|
||||
gSupportedExpressionArray[LET_TIMES][LST_VECTOR][LST_FLOATINGPOINT] = LST_VECTOR;
|
||||
gSupportedExpressionArray[LET_TIMES][LST_FLOATINGPOINT][LST_VECTOR] = LST_VECTOR;
|
||||
gSupportedExpressionArray[LET_TIMES][LST_VECTOR][LST_VECTOR] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_TIMES][LST_VECTOR][LST_QUATERNION] = LST_VECTOR;
|
||||
gSupportedExpressionArray[LET_TIMES][LST_QUATERNION][LST_QUATERNION] = LST_QUATERNION;
|
||||
|
||||
// LET_DIVIDE
|
||||
gSupportedExpressionArray[LET_DIVIDE][LST_INTEGER][LST_INTEGER] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_DIVIDE][LST_INTEGER][LST_FLOATINGPOINT] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_DIVIDE][LST_FLOATINGPOINT][LST_INTEGER] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_DIVIDE][LST_FLOATINGPOINT][LST_FLOATINGPOINT] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_DIVIDE][LST_VECTOR][LST_INTEGER] = LST_VECTOR;
|
||||
gSupportedExpressionArray[LET_DIVIDE][LST_VECTOR][LST_FLOATINGPOINT] = LST_VECTOR;
|
||||
gSupportedExpressionArray[LET_DIVIDE][LST_VECTOR][LST_QUATERNION] = LST_VECTOR;
|
||||
gSupportedExpressionArray[LET_DIVIDE][LST_QUATERNION][LST_QUATERNION] = LST_QUATERNION;
|
||||
|
||||
// LET_MOD
|
||||
gSupportedExpressionArray[LET_MOD][LST_INTEGER][LST_INTEGER] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_MOD][LST_VECTOR][LST_VECTOR] = LST_VECTOR;
|
||||
|
||||
// LET_BIT_AND
|
||||
gSupportedExpressionArray[LET_BIT_AND][LST_INTEGER][LST_INTEGER] = LST_INTEGER;
|
||||
|
||||
// LET_BIT_OR
|
||||
gSupportedExpressionArray[LET_BIT_OR][LST_INTEGER][LST_INTEGER] = LST_INTEGER;
|
||||
|
||||
// LET_BIT_XOR
|
||||
gSupportedExpressionArray[LET_BIT_XOR][LST_INTEGER][LST_INTEGER] = LST_INTEGER;
|
||||
|
||||
// LET_BOOLEAN_AND
|
||||
gSupportedExpressionArray[LET_BOOLEAN_AND][LST_INTEGER][LST_INTEGER] = LST_INTEGER;
|
||||
|
||||
// LET_BOOLEAN_OR
|
||||
gSupportedExpressionArray[LET_BOOLEAN_OR][LST_INTEGER][LST_INTEGER] = LST_INTEGER;
|
||||
|
||||
// LET_SHIFT_LEFT
|
||||
gSupportedExpressionArray[LET_SHIFT_LEFT][LST_INTEGER][LST_INTEGER] = LST_INTEGER;
|
||||
|
||||
// LET_SHIFT_RIGHT
|
||||
gSupportedExpressionArray[LET_SHIFT_RIGHT][LST_INTEGER][LST_INTEGER] = LST_INTEGER;
|
||||
|
||||
// LET_PARENTHESIS
|
||||
gSupportedExpressionArray[LET_PARENTHESIS][LST_INTEGER][LST_NULL] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_PARENTHESIS][LST_FLOATINGPOINT][LST_NULL] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_PARENTHESIS][LST_STRING][LST_NULL] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_PARENTHESIS][LST_LIST][LST_NULL] = LST_INTEGER;
|
||||
|
||||
// LET_UNARY_MINUS
|
||||
gSupportedExpressionArray[LET_UNARY_MINUS][LST_INTEGER][LST_NULL] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_UNARY_MINUS][LST_FLOATINGPOINT][LST_NULL] = LST_FLOATINGPOINT;
|
||||
gSupportedExpressionArray[LET_UNARY_MINUS][LST_VECTOR][LST_NULL] = LST_VECTOR;
|
||||
gSupportedExpressionArray[LET_UNARY_MINUS][LST_QUATERNION][LST_NULL] = LST_QUATERNION;
|
||||
|
||||
// LET_BOOLEAN_NOT
|
||||
gSupportedExpressionArray[LET_BOOLEAN_NOT][LST_INTEGER][LST_NULL] = LST_INTEGER;
|
||||
|
||||
// LET_BIT_NOT
|
||||
gSupportedExpressionArray[LET_BIT_NOT][LST_INTEGER][LST_NULL] = LST_INTEGER;
|
||||
|
||||
// LET_PRE_INCREMENT
|
||||
gSupportedExpressionArray[LET_PRE_INCREMENT][LST_INTEGER][LST_NULL] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_PRE_INCREMENT][LST_FLOATINGPOINT][LST_NULL] = LST_FLOATINGPOINT;
|
||||
|
||||
// LET_PRE_DECREMENT
|
||||
gSupportedExpressionArray[LET_PRE_DECREMENT][LST_INTEGER][LST_NULL] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_PRE_DECREMENT][LST_FLOATINGPOINT][LST_NULL] = LST_FLOATINGPOINT;
|
||||
|
||||
// LET_POST_INCREMENT
|
||||
gSupportedExpressionArray[LET_POST_INCREMENT][LST_INTEGER][LST_NULL] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_POST_INCREMENT][LST_FLOATINGPOINT][LST_NULL] = LST_FLOATINGPOINT;
|
||||
|
||||
// LET_POST_DECREMENT
|
||||
gSupportedExpressionArray[LET_POST_DECREMENT][LST_INTEGER][LST_NULL] = LST_INTEGER;
|
||||
gSupportedExpressionArray[LET_POST_DECREMENT][LST_FLOATINGPOINT][LST_NULL] = LST_FLOATINGPOINT;
|
||||
}
|
||||
|
||||
BOOL legal_binary_expression(LSCRIPTType &result, LSCRIPTType left_side, LSCRIPTType right_side, LSCRIPTExpressionType expression)
|
||||
{
|
||||
if ( (left_side == LST_UNDEFINED)
|
||||
||(right_side == LST_UNDEFINED))
|
||||
{
|
||||
result = LST_UNDEFINED;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ( (left_side == LST_NULL)
|
||||
||(right_side == LST_NULL))
|
||||
{
|
||||
result = LST_UNDEFINED;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
result = gSupportedExpressionArray[expression][left_side][right_side];
|
||||
if (result)
|
||||
return TRUE;
|
||||
else
|
||||
{
|
||||
result = LST_UNDEFINED;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL legal_unary_expression(LSCRIPTType &result, LSCRIPTType left_side, LSCRIPTExpressionType expression)
|
||||
{
|
||||
if (left_side == LST_UNDEFINED)
|
||||
{
|
||||
result = LST_UNDEFINED;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (left_side == LST_NULL)
|
||||
{
|
||||
result = LST_UNDEFINED;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
result = gSupportedExpressionArray[expression][left_side][LST_NULL];
|
||||
if (result)
|
||||
return TRUE;
|
||||
else
|
||||
{
|
||||
result = LST_UNDEFINED;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
124
indra/lscript/lscript_compile/lscript_typecheck.h
Normal file
124
indra/lscript/lscript_compile/lscript_typecheck.h
Normal file
@@ -0,0 +1,124 @@
|
||||
/**
|
||||
* @file lscript_typecheck.h
|
||||
* @brief typechecks script
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2009, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_LSCRIPT_TYPECHECK_H
|
||||
#define LL_LSCRIPT_TYPECHECK_H
|
||||
|
||||
#include "lscript_error.h"
|
||||
|
||||
LSCRIPTType implicit_casts(LSCRIPTType left_side, LSCRIPTType right_side);
|
||||
BOOL legal_casts(LSCRIPTType cast, LSCRIPTType base);
|
||||
LSCRIPTType promote(LSCRIPTType left_side, LSCRIPTType right_side);
|
||||
BOOL legal_assignment(LSCRIPTType left_side, LSCRIPTType right_side);
|
||||
|
||||
typedef enum e_lscript_expression_types
|
||||
{
|
||||
LET_NULL,
|
||||
LET_ASSIGNMENT,
|
||||
LET_ADD_ASSIGN,
|
||||
LET_SUB_ASSIGN,
|
||||
LET_MUL_ASSIGN,
|
||||
LET_DIV_ASSIGN,
|
||||
LET_MOD_ASSIGN,
|
||||
LET_EQUALITY,
|
||||
LET_NOT_EQUALS,
|
||||
LET_LESS_EQUALS,
|
||||
LET_GREATER_EQUALS,
|
||||
LET_LESS_THAN,
|
||||
LET_GREATER_THAN,
|
||||
LET_PLUS,
|
||||
LET_MINUS,
|
||||
LET_TIMES,
|
||||
LET_DIVIDE,
|
||||
LET_MOD,
|
||||
LET_BIT_AND,
|
||||
LET_BIT_OR,
|
||||
LET_BIT_XOR,
|
||||
LET_BOOLEAN_AND,
|
||||
LET_BOOLEAN_OR,
|
||||
LET_PARENTHESIS,
|
||||
LET_UNARY_MINUS,
|
||||
LET_BOOLEAN_NOT,
|
||||
LET_BIT_NOT,
|
||||
LET_PRE_INCREMENT,
|
||||
LET_PRE_DECREMENT,
|
||||
LET_CAST,
|
||||
LET_VECTOR_INITIALIZER,
|
||||
LET_QUATERNION_INITIALIZER,
|
||||
LET_LIST_INITIALIZER,
|
||||
LET_LVALUE,
|
||||
LET_POST_INCREMENT,
|
||||
LET_POST_DECREMENT,
|
||||
LET_FUNCTION_CALL,
|
||||
LET_CONSTANT,
|
||||
LET_FOR_EXPRESSION_LIST,
|
||||
LET_FUNC_EXPRESSION_LIST,
|
||||
LET_LIST_EXPRESSION_LIST,
|
||||
LET_PRINT,
|
||||
LET_SHIFT_LEFT,
|
||||
LET_SHIFT_RIGHT,
|
||||
LET_EOF
|
||||
} LSCRIPTExpressionType;
|
||||
|
||||
BOOL legal_binary_expression(LSCRIPTType &result, LSCRIPTType left_side, LSCRIPTType right_side, LSCRIPTExpressionType expression);
|
||||
BOOL legal_unary_expression(LSCRIPTType &result, LSCRIPTType left_side, LSCRIPTExpressionType expression);
|
||||
|
||||
void init_supported_expressions(void);
|
||||
|
||||
/*
|
||||
LScript automatic type casting
|
||||
|
||||
LST_INTEGER -> LST_INTEGER
|
||||
|
||||
LST_FLOATINGPOINT -> LST_FLOATINGPOINT
|
||||
LST_INTEGER -> LST_FLOATINGPOINT
|
||||
|
||||
LST_FLOATINGPOINT -> LST_STRING
|
||||
LST_INTEGER -> LST_STRING
|
||||
LST_STRING -> LST_STRING
|
||||
LST_VECTOR -> LST_STRING
|
||||
LST_QUATERNION -> LST_STRING
|
||||
LST_LIST -> LST_STRING
|
||||
|
||||
LST_VECTOR -> LST_VECTOR
|
||||
|
||||
LST_QUATERNION -> LST_QUATERNION
|
||||
|
||||
LST_FLOATINGPOINT -> LST_LIST
|
||||
LST_INTEGER -> LST_LIST
|
||||
LST_STRING -> LST_LIST
|
||||
LST_VECTOR -> LST_LIST
|
||||
LST_QUATERNION -> LST_LIST
|
||||
LST_LIST -> LST_LIST
|
||||
*/
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user