lscript_error.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LSCRIPT_ERROR_H
00033 #define LL_LSCRIPT_ERROR_H
00034 
00035 #include "lscript_scope.h"
00036 
00037 typedef enum e_lscript_compile_pass
00038 {
00039         LSCP_INVALID,
00040         LSCP_PRETTY_PRINT,
00041         LSCP_PRUNE,
00042         LSCP_SCOPE_PASS1,
00043         LSCP_SCOPE_PASS2,
00044         LSCP_TYPE,
00045         LSCP_RESOURCE,
00046         LSCP_EMIT_ASSEMBLY,
00047         LSCP_EMIT_BYTE_CODE,
00048         LSCP_DETERMINE_HANDLERS,
00049         LSCP_LIST_BUILD_SIMPLE,
00050         LSCP_TO_STACK,
00051         LSCP_BUILD_FUNCTION_ARGS,
00052         LSCP_EMIT_CIL_ASSEMBLY,
00053         LSCP_EOF
00054 } LSCRIPTCompilePass;
00055 
00056 typedef enum e_lscript_prune_type
00057 {
00058         LSPRUNE_INVALID,
00059         LSPRUNE_GLOBAL_VOIDS,
00060         LSPRUNE_GLOBAL_NON_VOIDS,
00061         LSPRUNE_EVENTS,
00062         LSPRUNE_DEAD_CODE,
00063         LSPRUNE_EOF
00064 } LSCRIPTPruneType;
00065 
00066 extern S32 gColumn;
00067 extern S32 gLine;
00068 extern S32 gInternalColumn;
00069 extern S32 gInternalLine;
00070 
00071 
00072 // used to describe where in the file this piece is
00073 class LLScriptByteCodeChunk;
00074 
00075 class LLScriptLibData;
00076 
00077 class LLScriptFilePosition
00078 {
00079 public:
00080         LLScriptFilePosition(S32 line, S32 col)
00081                 : mLineNumber(line), mColumnNumber(col), mByteOffset(0), mByteSize(0)
00082         {
00083         }
00084 
00085         virtual ~LLScriptFilePosition() {}
00086 
00087         virtual void recurse(FILE *fp, S32 tabs, S32 tabsize, 
00088                                                 LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, 
00089                                                 LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, 
00090                                                 LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) = 0;
00091         virtual S32 getSize() = 0;
00092 
00093         void fdotabs(FILE *fp, S32 tabs, S32 tabsize);
00094 
00095         S32 mLineNumber;
00096         S32 mColumnNumber;
00097 
00098         S32 mByteOffset;
00099         S32 mByteSize;
00100 };
00101 
00102 typedef enum e_lscript_warnings
00103 {
00104         LSWARN_INVALID,
00105         LSWARN_DEAD_CODE,
00106         LSWARN_EOF
00107 } LSCRIPTWarnings;
00108 
00109 typedef enum e_lscript_errors
00110 {
00111         LSERROR_INVALID,
00112         LSERROR_SYNTAX_ERROR,
00113         LSERROR_NO_RETURN,
00114         LSERROR_INVALID_VOID_RETURN,
00115         LSERROR_INVALID_RETURN,
00116         LSERROR_STATE_CHANGE_IN_GLOBAL,
00117         LSERROR_DUPLICATE_NAME,
00118         LSERROR_UNDEFINED_NAME,
00119         LSERROR_TYPE_MISMATCH,
00120         LSERROR_EXPRESSION_ON_LVALUE,
00121         LSERROR_ASSEMBLE_OUT_OF_MEMORY,
00122         LSERROR_FUNCTION_TYPE_ERROR,
00123         LSERROR_VECTOR_METHOD_ERROR,
00124         LSERROR_NO_LISTS_IN_LISTS,
00125         LSERROR_NO_UNITIALIZED_VARIABLES_IN_LISTS,
00126         LSERROR_NEED_NEW_SCOPE,
00127         LSERROR_EOF
00128 } LSCRIPTErrors;
00129 
00130 class LLScriptGenerateErrorText
00131 {
00132 public:
00133         LLScriptGenerateErrorText() { init(); }
00134         ~LLScriptGenerateErrorText() {}
00135 
00136         void init() { mTotalErrors = 0; mTotalWarnings = 0; }
00137 
00138         void writeWarning(FILE *fp, LLScriptFilePosition *pos, LSCRIPTWarnings warning);
00139         void writeWarning(FILE *fp, S32 line, S32 col, LSCRIPTWarnings warning);
00140         void writeError(FILE *fp, LLScriptFilePosition *pos, LSCRIPTErrors error);
00141         void writeError(FILE *fp, S32 line, S32 col, LSCRIPTErrors error);
00142 
00143         BOOL getErrors() { return mTotalErrors; }
00144         BOOL getWarnings() { return mTotalWarnings; }
00145 
00146         S32 mTotalErrors;
00147         S32 mTotalWarnings;
00148 };
00149 
00150 extern LLScriptGenerateErrorText gErrorToText;
00151 
00152 #endif

Generated on Thu Jul 1 06:09:50 2010 for Second Life Viewer by  doxygen 1.4.7