diff options
Diffstat (limited to 'lib/syntax/S.ml')
-rw-r--r-- | lib/syntax/S.ml | 50 |
1 files changed, 9 insertions, 41 deletions
diff --git a/lib/syntax/S.ml b/lib/syntax/S.ml index a3c74ca..04490af 100644 --- a/lib/syntax/S.ml +++ b/lib/syntax/S.ml @@ -29,6 +29,9 @@ type ('a, 'b) variable = { pos : 'a; name : string; index : 'b option } type ('a, 'b) clause = pos * 'a * 'b list +type extract_context = { f : 'a. 'a Type.Id.t -> 'a option } [@@unboxed] +(** Extract the given value from the context *) + (** {1 Checker Signature} *) (** Represent the evaluation over an expression *) @@ -40,22 +43,22 @@ module type Expression = sig (** External type used outside of the module *) val v : t -> t' - val ident : (pos, t) variable -> t + val ident : ctx:extract_context -> (pos, t) variable -> t (* Basic values, text, number… *) - val integer : pos -> string -> t - val literal : pos -> t T.literal list -> t + val integer : ctx:extract_context -> pos -> string -> t + val literal : ctx:extract_context -> pos -> t T.literal list -> t - val function_ : pos -> T.function_ -> t list -> t + val function_ : ctx:extract_context -> pos -> T.function_ -> t list -> t (** Call a function. The functions list is hardcoded in lib/lexer.mll *) - val uoperator : pos -> T.uoperator -> t -> t + val uoperator : ctx:extract_context -> pos -> T.uoperator -> t -> t (** Unary operator like [-123] or [+'Text']*) - val boperator : pos -> T.boperator -> t -> t -> t + val boperator : ctx:extract_context -> pos -> T.boperator -> t -> t -> t (** Binary operator, for a comparaison, or an operation *) end @@ -108,41 +111,6 @@ module type Location = sig val location : context -> pos -> instruction list -> t end -(** {1 Unified module used by the parser} *) - -module type Analyzer = sig - val identifier : string - (** Identifier for the module *) - - val description : string - (** Short description*) - - val active : bool ref - (** Is the test active or not *) - - val is_global : bool - (** Declare the checker as global. It requires to run over the whole file and - will be disabled if the application only check a single location. - - Also, the test will be disabled if a syntax error is reported during the - parsing, because this tell that I haven’t been able to analyse the whole - source code. *) - - type context - (** Context used to keep information during the whole test *) - - val initialize : unit -> context - (** Initialize the context before starting to parse the content *) - - module Expression : Expression - module Instruction : Instruction with type expression := Expression.t' - - module Location : - Location with type instruction := Instruction.t' and type context := context - - val finalize : context -> (string * Report.t) list -end - (** Helper module used in order to convert elements from the differents representation levels. |