PageRenderTime 31ms CodeModel.GetById 23ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

/indra/lscript/lscript_compile/lscript_typecheck.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 118 lines | 59 code | 8 blank | 51 comment | 0 complexity | f03ef39143b46b280e072f6ffa1486cd MD5 | raw file
  1/** 
  2 * @file lscript_typecheck.h
  3 * @brief typechecks script
  4 *
  5 * $LicenseInfo:firstyear=2002&license=viewerlgpl$
  6 * Second Life Viewer Source Code
  7 * Copyright (C) 2010, Linden Research, Inc.
  8 * 
  9 * This library is free software; you can redistribute it and/or
 10 * modify it under the terms of the GNU Lesser General Public
 11 * License as published by the Free Software Foundation;
 12 * version 2.1 of the License only.
 13 * 
 14 * This library is distributed in the hope that it will be useful,
 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 17 * Lesser General Public License for more details.
 18 * 
 19 * You should have received a copy of the GNU Lesser General Public
 20 * License along with this library; if not, write to the Free Software
 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 22 * 
 23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 24 * $/LicenseInfo$
 25 */
 26
 27#ifndef LL_LSCRIPT_TYPECHECK_H
 28#define LL_LSCRIPT_TYPECHECK_H
 29
 30#include "lscript_error.h"
 31
 32LSCRIPTType implicit_casts(LSCRIPTType left_side, LSCRIPTType right_side);
 33BOOL legal_casts(LSCRIPTType cast, LSCRIPTType base);
 34LSCRIPTType promote(LSCRIPTType left_side, LSCRIPTType right_side);
 35BOOL legal_assignment(LSCRIPTType left_side, LSCRIPTType right_side);
 36
 37typedef enum e_lscript_expression_types
 38{
 39	LET_NULL,
 40	LET_ASSIGNMENT,
 41	LET_ADD_ASSIGN,
 42	LET_SUB_ASSIGN,
 43	LET_MUL_ASSIGN,
 44	LET_DIV_ASSIGN,
 45	LET_MOD_ASSIGN,
 46	LET_EQUALITY,
 47	LET_NOT_EQUALS,
 48	LET_LESS_EQUALS,
 49	LET_GREATER_EQUALS,
 50	LET_LESS_THAN,
 51	LET_GREATER_THAN,
 52	LET_PLUS,
 53	LET_MINUS,
 54	LET_TIMES,
 55	LET_DIVIDE,
 56	LET_MOD,
 57	LET_BIT_AND,
 58	LET_BIT_OR,
 59	LET_BIT_XOR,
 60	LET_BOOLEAN_AND,
 61	LET_BOOLEAN_OR,
 62	LET_PARENTHESIS,
 63	LET_UNARY_MINUS,
 64	LET_BOOLEAN_NOT,
 65	LET_BIT_NOT,
 66	LET_PRE_INCREMENT,
 67	LET_PRE_DECREMENT,
 68	LET_CAST,
 69	LET_VECTOR_INITIALIZER,
 70	LET_QUATERNION_INITIALIZER,
 71	LET_LIST_INITIALIZER,
 72	LET_LVALUE,
 73	LET_POST_INCREMENT,
 74	LET_POST_DECREMENT,
 75	LET_FUNCTION_CALL,
 76	LET_CONSTANT,
 77	LET_FOR_EXPRESSION_LIST,
 78	LET_FUNC_EXPRESSION_LIST,
 79	LET_LIST_EXPRESSION_LIST,
 80	LET_PRINT,
 81	LET_SHIFT_LEFT,
 82	LET_SHIFT_RIGHT,
 83	LET_EOF
 84} LSCRIPTExpressionType;
 85
 86BOOL legal_binary_expression(LSCRIPTType &result, LSCRIPTType left_side, LSCRIPTType right_side, LSCRIPTExpressionType expression);
 87BOOL legal_unary_expression(LSCRIPTType &result, LSCRIPTType left_side, LSCRIPTExpressionType expression);
 88
 89void init_supported_expressions(void);
 90
 91/*
 92  LScript automatic type casting
 93
 94  LST_INTEGER			-> LST_INTEGER
 95
 96  LST_FLOATINGPOINT		-> LST_FLOATINGPOINT
 97  LST_INTEGER			-> LST_FLOATINGPOINT
 98
 99  LST_FLOATINGPOINT		-> LST_STRING
100  LST_INTEGER			-> LST_STRING
101  LST_STRING			-> LST_STRING
102  LST_VECTOR			-> LST_STRING
103  LST_QUATERNION		-> LST_STRING
104  LST_LIST				-> LST_STRING
105
106  LST_VECTOR			-> LST_VECTOR
107  
108  LST_QUATERNION		-> LST_QUATERNION
109  
110  LST_FLOATINGPOINT		-> LST_LIST
111  LST_INTEGER			-> LST_LIST
112  LST_STRING			-> LST_LIST
113  LST_VECTOR			-> LST_LIST
114  LST_QUATERNION		-> LST_LIST
115  LST_LIST				-> LST_LIST
116*/
117
118#endif