From c2f87ff1e6e5676968804cd50b86fc2f0f9ad672 Mon Sep 17 00:00:00 2001 From: Chimrod <> Date: Sat, 7 Oct 2023 12:24:37 +0200 Subject: Made explicit the use of the report in the parser --- lib/syntax/default.ml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'lib/syntax/default.ml') diff --git a/lib/syntax/default.ml b/lib/syntax/default.ml index 9c5073c..eed7f2b 100644 --- a/lib/syntax/default.ml +++ b/lib/syntax/default.ml @@ -3,14 +3,7 @@ This module is expected to be used when you only need to implement an analyze over a limited part of the whole syntax. *) -type pos = Lexing.position * Lexing.position -type ('a, 'b) variable = { pos : 'a; name : string; index : 'b option } - module Expression = struct - type 'a obs - type repr = unit - - type variable (** Describe a variable, using the name in capitalized text, and an optionnal index. @@ -18,21 +11,28 @@ module Expression = struct If missing, the index should be considered as [0]. *) - let ident : variable -> repr = fun _ -> () + type t = unit + type t' = unit + + let ident : (S.pos, t S.repr) S.variable -> t S.repr = + fun _ report -> ((), report) (* Basic values, text, number… *) - let integer : pos -> string -> repr = fun _ _ -> () - let literal : pos -> string -> repr = fun _ _ -> () + let integer : S.pos -> string -> t S.repr = fun _ _ report -> ((), report) + let literal : S.pos -> string -> t S.repr = fun _ _ report -> ((), report) (** Call a function. The functions list is hardcoded in lib/lexer.mll *) - let function_ : pos -> T.function_ -> repr list -> repr = fun _ _ _ -> () + let function_ : S.pos -> T.function_ -> t S.repr list -> t S.repr = + fun _ _ _ report -> ((), report) (** Unary operator like [-123] or [+'Text']*) - let uoperator : pos -> T.uoperator -> repr -> repr = fun _ _ _ -> () + let uoperator : S.pos -> T.uoperator -> t S.repr -> t S.repr = + fun _ _ _ report -> ((), report) (** Binary operator, for a comparaison, or an operation *) - let boperator : pos -> T.boperator -> repr -> repr -> repr = fun _ _ _ _ -> () + let boperator : S.pos -> T.boperator -> t S.repr -> t S.repr -> t S.repr = + fun _ _ _ _ report -> ((), report) end -- cgit v1.2.3