cppAst.ml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. open Type
  2. open Globals
  3. type tcpp =
  4. | TCppDynamic
  5. | TCppUnchanged
  6. | TCppObject
  7. | TCppObjectPtr
  8. | TCppVoid
  9. | TCppNull
  10. | TCppEnum of tenum
  11. | TCppScalar of string
  12. | TCppString
  13. | TCppFastIterator of tcpp
  14. | TCppPointer of string * tcpp
  15. | TCppRawPointer of string * tcpp
  16. | TCppFunction of tcpp list * tcpp * string
  17. | TCppObjCBlock of tcpp list * tcpp
  18. | TCppRest of tcpp
  19. | TCppReference of tcpp
  20. | TCppStruct of tcpp
  21. | TCppStar of tcpp * bool
  22. | TCppVoidStar
  23. | TCppVarArg
  24. | TCppAutoCast
  25. | TCppDynamicArray
  26. | TCppObjectArray of tcpp
  27. | TCppWrapped of tcpp
  28. | TCppScalarArray of tcpp
  29. | TCppObjC of tclass
  30. | TCppNativePointer of tclass
  31. | TCppVariant
  32. | TCppCode of tcpp
  33. | TCppInst of tclass * tcpp list
  34. | TCppInterface of tclass
  35. | TCppProtocol of tclass
  36. | TCppClass
  37. | TCppGlobal
  38. and tcppexpr = { cppexpr : tcpp_expr_expr; cpptype : tcpp; cpppos : pos }
  39. and tcpp_closure = {
  40. close_type : tcpp;
  41. close_args : (tvar * texpr option) list;
  42. close_expr : tcppexpr;
  43. close_id : int;
  44. close_undeclared : (string, tvar) Hashtbl.t;
  45. close_this : tcppthis option;
  46. }
  47. and tcppcrementop = CppIncrement | CppDecrement
  48. and tcppunop = CppNeg | CppNegBits | CppNot
  49. and tcppthis = ThisReal | ThisFake | ThisDynamic
  50. and tcppvarloc =
  51. | VarLocal of tvar
  52. | VarClosure of tvar
  53. | VarThis of tclass_field * tcpp
  54. | VarInstance of tcppexpr * tclass_field * string * string
  55. | VarInterface of tcppexpr * tclass_field
  56. | VarStatic of tclass * bool * tclass_field
  57. | VarInternal of tcppexpr * string * string
  58. and tcppinst = InstPtr | InstObjC | InstStruct
  59. and tcppfuncloc =
  60. | FuncThis of tclass_field * tcpp
  61. | FuncInstance of tcppexpr * tcppinst * tclass_field
  62. | FuncStatic of tclass * bool * tclass_field
  63. | FuncTemplate of tclass * tclass_field * path * bool
  64. | FuncInterface of tcppexpr * tclass * tclass_field
  65. | FuncEnumConstruct of tenum * tenum_field
  66. | FuncSuperConstruct of tcpp
  67. | FuncSuper of tcppthis * tcpp * tclass_field
  68. | FuncNew of tcpp
  69. | FuncExpression of tcppexpr
  70. | FuncInternal of tcppexpr * string * string
  71. | FuncExtern of string * bool
  72. | FuncFromStaticFunction
  73. and tcpparrayloc =
  74. | ArrayTyped of tcppexpr * tcppexpr * tcpp
  75. | ArrayPointer of tcppexpr * tcppexpr
  76. | ArrayRawPointer of tcppexpr * tcppexpr
  77. | ArrayObject of tcppexpr * tcppexpr * tcpp
  78. | ArrayVirtual of tcppexpr * tcppexpr
  79. | ArrayImplements of tclass * tcppexpr * tcppexpr
  80. | ArrayDynamic of tcppexpr * tcppexpr
  81. and tcpplvalue =
  82. | CppVarRef of tcppvarloc
  83. | CppArrayRef of tcpparrayloc
  84. | CppDynamicRef of tcppexpr * string
  85. | CppExternRef of string * bool
  86. and tcpp_expr_expr =
  87. | CppInt of int32
  88. | CppFloat of string
  89. | CppString of string
  90. | CppBool of bool
  91. | CppNull
  92. | CppNullAccess
  93. | CppNil
  94. | CppThis of tcppthis
  95. | CppSuper of tcppthis
  96. | CppCode of string * tcppexpr list
  97. | CppClosure of tcpp_closure
  98. | CppVar of tcppvarloc
  99. | CppExtern of string * bool
  100. | CppDynamicField of tcppexpr * string
  101. | CppFunction of tcppfuncloc * tcpp
  102. | CppEnumIndex of tcppexpr
  103. | CppEnumField of tenum * tenum_field
  104. | CppCall of tcppfuncloc * tcppexpr list
  105. | CppFunctionAddress of tclass * tclass_field
  106. | CppNewNative of tcppexpr
  107. | CppAddressOf of tcppexpr
  108. | CppDereference of tcppexpr
  109. | CppArray of tcpparrayloc
  110. | CppCrement of tcppcrementop * Ast.unop_flag * tcpplvalue
  111. | CppSet of tcpplvalue * tcppexpr
  112. | CppModify of Ast.binop * tcpplvalue * tcppexpr
  113. | CppBinop of Ast.binop * tcppexpr * tcppexpr
  114. | CppCompare of string * tcppexpr * tcppexpr * Ast.binop
  115. | CppNullCompare of string * tcppexpr
  116. | CppObjectDecl of (string * tcppexpr) list * bool
  117. | CppPosition of string * int32 * string * string
  118. | CppArrayDecl of tcppexpr list
  119. | CppUnop of tcppunop * tcppexpr
  120. | CppVarDecl of tvar * tcppexpr option
  121. | CppBlock of tcppexpr list * tcpp_closure list * bool
  122. | CppFor of tvar * tcppexpr * tcppexpr
  123. | CppIf of tcppexpr * tcppexpr * tcppexpr option
  124. | CppWhile of tcppexpr * tcppexpr * Ast.while_flag * int
  125. | CppIntSwitch of tcppexpr * (Int32.t list * tcppexpr) list * tcppexpr option
  126. | CppSwitch of
  127. tcppexpr * tcpp * (tcppexpr list * tcppexpr) list * tcppexpr option * int
  128. | CppTry of tcppexpr * (tvar * tcppexpr) list
  129. | CppBreak
  130. | CppContinue
  131. | CppClassOf of path * bool
  132. | CppGoto of int
  133. | CppReturn of tcppexpr option
  134. | CppThrow of tcppexpr
  135. | CppEnumParameter of tcppexpr * tenum_field * int
  136. | CppTCast of tcppexpr * tcpp
  137. | CppCast of tcppexpr * tcpp
  138. | CppCastStatic of tcppexpr * tcpp
  139. | CppCastScalar of tcppexpr * string
  140. | CppCastVariant of tcppexpr
  141. | CppCastObjC of tcppexpr * tclass
  142. | CppCastObjCBlock of tcppexpr * tcpp list * tcpp
  143. | CppCastProtocol of tcppexpr * tclass
  144. | CppCastNative of tcppexpr