package catala
Compiler and library for the literate programming language for tax code specification
Install
dune-project
Dependency
Authors
Maintainers
Sources
1.0.0-alpha.tar.gz
md5=2615968670ac21b1d00386a9b04b3843
sha512=eff292fdd75012f26ce7b17020f5a8374eef37cd4dd6ba60338dfbe89fbcad3443d1b409e44c182b740da9f58dff7e76dcb8ddefe47f9b2b160666d1c6930143
doc/src/catala.catala_utils/global.ml.html
Source file global.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
(* This file is part of the Catala compiler, a specification language for tax and social benefits computation rules. Copyright (C) 2024 Inria, contributors: Louis Gesbert <louis.gesbert@inria.fr> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) type file = string type raw_file = file type backend_lang = En | Fr | Pl type when_enum = Auto | Always | Never type message_format_enum = Human | GNU | Lsp type trace_format_enum = Human | JSON type 'file input_src = | FileName of 'file | Contents of string * 'file | Stdin of 'file (* ['file] is expected to be [file] or [raw_file] *) type options = { mutable input_src : file input_src; mutable language : backend_lang option; mutable debug : bool; mutable color : when_enum; mutable message_format : message_format_enum; mutable trace : Format.formatter Lazy.t option; mutable trace_format : trace_format_enum; mutable plugins_dirs : file list; mutable disable_warnings : bool; mutable max_prec_digits : int; mutable path_rewrite : raw_file -> file; mutable stop_on_error : bool; mutable no_fail_on_assert : bool; mutable whole_program : bool; mutable bin_dir : string; mutable gen_external : bool; mutable no_stdlib : bool; } (* Note: we force that the global options (ie options common to all commands) and the options available through global refs are the same. While this is a bit arbitrary, it makes some sense code-wise and provides some safeguard against explosion of the number of global references. Reducing the number of globals further would be nice though. *) let options = { input_src = Stdin "-stdin-"; language = None; debug = false; color = Auto; message_format = Human; trace = None; trace_format = Human; plugins_dirs = []; disable_warnings = false; max_prec_digits = 20; path_rewrite = (fun _ -> assert false); stop_on_error = false; no_fail_on_assert = false; whole_program = false; bin_dir = Filename.current_dir_name; gen_external = false; no_stdlib = false; } let enforce_options ?input_src ?language ?debug ?color ?message_format ?trace ?trace_format ?plugins_dirs ?disable_warnings ?max_prec_digits ?path_rewrite ?stop_on_error ?no_fail_on_assert ?whole_program ?bin_dir ?gen_external ?no_stdlib () = Option.iter (fun x -> options.input_src <- x) input_src; Option.iter (fun x -> options.language <- x) language; Option.iter (fun x -> options.debug <- x) debug; Option.iter (fun x -> options.color <- x) color; Option.iter (fun x -> options.message_format <- x) message_format; Option.iter (fun x -> options.trace <- x) trace; Option.iter (fun x -> options.trace_format <- x) trace_format; Option.iter (fun x -> options.plugins_dirs <- x) plugins_dirs; Option.iter (fun x -> options.disable_warnings <- x) disable_warnings; Option.iter (fun x -> options.max_prec_digits <- x) max_prec_digits; Option.iter (fun x -> options.path_rewrite <- x) path_rewrite; Option.iter (fun x -> options.stop_on_error <- x) stop_on_error; Option.iter (fun x -> options.no_fail_on_assert <- x) no_fail_on_assert; Option.iter (fun x -> options.whole_program <- x) whole_program; Option.iter (fun x -> options.bin_dir <- x) bin_dir; Option.iter (fun x -> options.gen_external <- x) gen_external; Option.iter (fun x -> options.no_stdlib <- x) no_stdlib; options let input_src_file = function FileName f | Contents (_, f) | Stdin f -> f let raw_file f = f let has_localised_stdlib = function En | Fr -> true | _ -> false
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>