t.ml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. (**
  2. This module contains the basic operators used in the QSP syntax.
  3. *)
  4. type 'a literal = Text of string | Expression of 'a
  5. let map_litteral : f:('a -> 'b) -> 'a literal -> 'b literal =
  6. fun ~f -> function Text t -> Text t | Expression e -> Expression (f e)
  7. type boperator =
  8. | Eq
  9. | Neq
  10. | Plus
  11. | Minus
  12. | Product
  13. | Div
  14. | Gt
  15. | Lt
  16. | Gte
  17. | Lte
  18. | And
  19. | Or
  20. | Mod
  21. [@@deriving eq, show]
  22. and uoperator = No | Neg | Add [@@deriving eq, show]
  23. and assignation_operator =
  24. | Eq'
  25. | Inc (** += *)
  26. | Decr (** -= *)
  27. | Mult
  28. | Div_assign
  29. [@@deriving eq, show]
  30. type function_ =
  31. | Arrcomp
  32. | Arrpos
  33. | Arrsize
  34. | Countobj
  35. | Desc
  36. | Desc'
  37. | Dyneval
  38. | Dyneval'
  39. | Func
  40. | Func'
  41. | Getobj
  42. | Getobj'
  43. | Iif
  44. | Iif'
  45. | Input
  46. | Input'
  47. | Instr
  48. | Isnum
  49. | Isplay
  50. | Lcase
  51. | Lcase'
  52. | Len
  53. | Loc
  54. | Max
  55. | Max'
  56. | Mid
  57. | Mid'
  58. | Min
  59. | Min'
  60. | Msecscount
  61. | Rand
  62. | Replace
  63. | Replace'
  64. | Rgb
  65. | Rnd
  66. | Selact
  67. | Str
  68. | Str'
  69. | Strcomp
  70. | Strfind
  71. | Strfind'
  72. | Strpos
  73. | Trim
  74. | Trim'
  75. | Ucase
  76. | Ucase'
  77. | Val
  78. [@@deriving eq, show]
  79. type keywords =
  80. | IncLib
  81. | Addobj
  82. | Cla
  83. | Clear
  84. | Clear'
  85. | Close
  86. | CloseAll
  87. | Cls
  88. | CmdClear
  89. | CopyArr
  90. | DelAct
  91. | FreeLib
  92. | DelObj
  93. | Dynamic
  94. | Exec
  95. | Exit
  96. | Gosub
  97. | Goto
  98. | Jump
  99. | KillAll
  100. | KillObj
  101. | KillVar
  102. | MainTxt
  103. | MainTxt'
  104. | Menu
  105. | Msg
  106. | Nl
  107. | Nl'
  108. | P
  109. | P'
  110. | Pl
  111. | Pl'
  112. | Play
  113. | OpenGame
  114. | OpenQst
  115. | RefInt
  116. | SaveGame
  117. | SetTimer
  118. | ShowActs
  119. | ShowInput
  120. | ShowObjs
  121. | ShowStat
  122. | Stattxt
  123. | Stattxt'
  124. | Unselect
  125. | View
  126. | Wait
  127. | XGoto
  128. [@@deriving eq, show]