default.ml 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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.variable -> T'.t = fun _ -> T'.default
  15. (*
  16. Basic values, text, number…
  17. *)
  18. let integer : S.pos -> string -> T'.t = fun _ _ -> T'.default
  19. let literal : S.pos -> T'.t T.literal list -> T'.t = fun _ _ -> T'.default
  20. (** Call a function. The functions list is hardcoded in lib/lexer.mll *)
  21. let function_ : S.pos -> T.function_ -> T'.t list -> T'.t =
  22. fun _ _ _ -> T'.default
  23. (** Unary operator like [-123] or [+'Text']*)
  24. let uoperator : S.pos -> T.uoperator -> T'.t -> T'.t = fun _ _ _ -> T'.default
  25. (** Binary operator, for a comparaison, or an operation *)
  26. let boperator : S.pos -> T.boperator -> T'.t -> T'.t -> T'.t =
  27. fun _ _ _ _ -> T'.default
  28. end