PageRenderTime 47ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/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
Possible License(s): LGPL-2.1
  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. #ifndef LL_LSCRIPT_TYPECHECK_H
  27. #define LL_LSCRIPT_TYPECHECK_H
  28. #include "lscript_error.h"
  29. LSCRIPTType implicit_casts(LSCRIPTType left_side, LSCRIPTType right_side);
  30. BOOL legal_casts(LSCRIPTType cast, LSCRIPTType base);
  31. LSCRIPTType promote(LSCRIPTType left_side, LSCRIPTType right_side);
  32. BOOL legal_assignment(LSCRIPTType left_side, LSCRIPTType right_side);
  33. typedef enum e_lscript_expression_types
  34. {
  35. LET_NULL,
  36. LET_ASSIGNMENT,
  37. LET_ADD_ASSIGN,
  38. LET_SUB_ASSIGN,
  39. LET_MUL_ASSIGN,
  40. LET_DIV_ASSIGN,
  41. LET_MOD_ASSIGN,
  42. LET_EQUALITY,
  43. LET_NOT_EQUALS,
  44. LET_LESS_EQUALS,
  45. LET_GREATER_EQUALS,
  46. LET_LESS_THAN,
  47. LET_GREATER_THAN,
  48. LET_PLUS,
  49. LET_MINUS,
  50. LET_TIMES,
  51. LET_DIVIDE,
  52. LET_MOD,
  53. LET_BIT_AND,
  54. LET_BIT_OR,
  55. LET_BIT_XOR,
  56. LET_BOOLEAN_AND,
  57. LET_BOOLEAN_OR,
  58. LET_PARENTHESIS,
  59. LET_UNARY_MINUS,
  60. LET_BOOLEAN_NOT,
  61. LET_BIT_NOT,
  62. LET_PRE_INCREMENT,
  63. LET_PRE_DECREMENT,
  64. LET_CAST,
  65. LET_VECTOR_INITIALIZER,
  66. LET_QUATERNION_INITIALIZER,
  67. LET_LIST_INITIALIZER,
  68. LET_LVALUE,
  69. LET_POST_INCREMENT,
  70. LET_POST_DECREMENT,
  71. LET_FUNCTION_CALL,
  72. LET_CONSTANT,
  73. LET_FOR_EXPRESSION_LIST,
  74. LET_FUNC_EXPRESSION_LIST,
  75. LET_LIST_EXPRESSION_LIST,
  76. LET_PRINT,
  77. LET_SHIFT_LEFT,
  78. LET_SHIFT_RIGHT,
  79. LET_EOF
  80. } LSCRIPTExpressionType;
  81. BOOL legal_binary_expression(LSCRIPTType &result, LSCRIPTType left_side, LSCRIPTType right_side, LSCRIPTExpressionType expression);
  82. BOOL legal_unary_expression(LSCRIPTType &result, LSCRIPTType left_side, LSCRIPTExpressionType expression);
  83. void init_supported_expressions(void);
  84. /*
  85. LScript automatic type casting
  86. LST_INTEGER -> LST_INTEGER
  87. LST_FLOATINGPOINT -> LST_FLOATINGPOINT
  88. LST_INTEGER -> LST_FLOATINGPOINT
  89. LST_FLOATINGPOINT -> LST_STRING
  90. LST_INTEGER -> LST_STRING
  91. LST_STRING -> LST_STRING
  92. LST_VECTOR -> LST_STRING
  93. LST_QUATERNION -> LST_STRING
  94. LST_LIST -> LST_STRING
  95. LST_VECTOR -> LST_VECTOR
  96. LST_QUATERNION -> LST_QUATERNION
  97. LST_FLOATINGPOINT -> LST_LIST
  98. LST_INTEGER -> LST_LIST
  99. LST_STRING -> LST_LIST
  100. LST_VECTOR -> LST_LIST
  101. LST_QUATERNION -> LST_LIST
  102. LST_LIST -> LST_LIST
  103. */
  104. #endif