default.ml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. (** Default implementation which does nothing.
  2. This module is expected to be used when you only need to implement an analyze
  3. over a limited part of the whole syntax. *)
  4. module type T = sig
  5. type t
  6. val default : t
  7. end
  8. module Expression (T' : T) = struct
  9. (**
  10. Describe a variable, using the name in capitalized text, and an optionnal
  11. index.
  12. If missing, the index should be considered as [0].
  13. *)
  14. let ident : (S.pos, T'.t S.repr) S.variable -> T'.t S.repr =
  15. fun _ report -> (T'.default, report)
  16. (*
  17. Basic values, text, number…
  18. *)
  19. let integer : S.pos -> string -> T'.t S.repr =
  20. fun _ _ report -> (T'.default, report)
  21. let literal : S.pos -> string -> T'.t S.repr =
  22. fun _ _ report -> (T'.default, report)
  23. (** Call a function. The functions list is hardcoded in lib/lexer.mll *)
  24. let function_ : S.pos -> T.function_ -> T'.t S.repr list -> T'.t S.repr =
  25. fun _ _ _ report -> (T'.default, report)
  26. (** Unary operator like [-123] or [+'Text']*)
  27. let uoperator : S.pos -> T.uoperator -> T'.t S.repr -> T'.t S.repr =
  28. fun _ _ _ report -> (T'.default, report)
  29. (** Binary operator, for a comparaison, or an operation *)
  30. let boperator :
  31. S.pos -> T.boperator -> T'.t S.repr -> T'.t S.repr -> T'.t S.repr =
  32. fun _ _ _ _ report -> (T'.default, report)
  33. end