diff options
author | James Cook <james@lindenlab.com> | 2007-01-02 08:33:20 +0000 |
---|---|---|
committer | James Cook <james@lindenlab.com> | 2007-01-02 08:33:20 +0000 |
commit | 420b91db29485df39fd6e724e782c449158811cb (patch) | |
tree | b471a94563af914d3ed3edd3e856d21cb1b69945 /indra/lscript/lscript_compile/lscript_error.h |
Print done when done.
Diffstat (limited to 'indra/lscript/lscript_compile/lscript_error.h')
-rw-r--r-- | indra/lscript/lscript_compile/lscript_error.h | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/indra/lscript/lscript_compile/lscript_error.h b/indra/lscript/lscript_compile/lscript_error.h new file mode 100644 index 0000000000..4ad7b60dd8 --- /dev/null +++ b/indra/lscript/lscript_compile/lscript_error.h @@ -0,0 +1,132 @@ +/** + * @file lscript_error.h + * @brief error reporting class and strings + * + * Copyright (c) 2002-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#ifndef LL_LSCRIPT_ERROR_H +#define LL_LSCRIPT_ERROR_H + +#include <stdio.h> +#include "stdtypes.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(FILE *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(FILE *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_EOF +} LSCRIPTErrors; + +class LLScriptGenerateErrorText +{ +public: + LLScriptGenerateErrorText() { init(); } + ~LLScriptGenerateErrorText() {} + + void init() { mTotalErrors = 0; mTotalWarnings = 0; } + + void writeWarning(FILE *fp, LLScriptFilePosition *pos, LSCRIPTWarnings warning); + void writeWarning(FILE *fp, S32 line, S32 col, LSCRIPTWarnings warning); + void writeError(FILE *fp, LLScriptFilePosition *pos, LSCRIPTErrors error); + void writeError(FILE *fp, S32 line, S32 col, LSCRIPTErrors error); + + BOOL getErrors() { return mTotalErrors; } + BOOL getWarnings() { return mTotalWarnings; } + + S32 mTotalErrors; + S32 mTotalWarnings; +}; + +extern LLScriptGenerateErrorText gErrorToText; + +#endif |