package catala
Compiler and library for the literate programming language for tax code specification
Install
Dune Dependency
Authors
Maintainers
Sources
0.6.0.tar.gz
md5=b22e238d5d5c8452067109e9c7c0f427
sha512=ccc8c557c67c2f9d1bed4b957b2367f0f6afc0ef9b8b83237cf2a2912b3e8829b7e8af78ea7fe00b20ecf28b436ad04b591e5fff4f82fd08725d40a18c9924d0
doc/src/catala.lcalc/backends.ml.html
Source file backends.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
(* This file is part of the Catala compiler, a specification language for tax and social benefits computation rules. Copyright (C) 2021 Inria, contributor: Denis Merigoux <denis.merigoux@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. *) let to_ascii (s : string) : string = let out = ref "" in CamomileLibraryDefault.Camomile.UTF8.iter (fun c -> let code = CamomileLibraryDefault.Camomile.UChar.uint_code c in out := !out ^ match code with | 0xc7 -> "C" | 0xe7 -> "c" | c when c >= 0xc0 && c <= 0xc6 -> "A" | c when c >= 0xe0 && c <= 0xe6 -> "a" | c when c >= 0xc8 && c <= 0xcb -> "E" | c when c >= 0xe8 && c <= 0xeb -> "e" | c when c >= 0xcc && c <= 0xcf -> "I" | c when c >= 0xec && c <= 0xef -> "i" | c when c >= 0xd2 && c <= 0xd6 -> "O" | c when c >= 0xf2 && c <= 0xf6 -> "o" | c when c >= 0xd9 && c <= 0xdc -> "U" | c when c >= 0xf9 && c <= 0xfc -> "u" | _ -> if code > 128 then "_" else String.make 1 (CamomileLibraryDefault.Camomile.UChar.char_of c)) s; !out let to_lowercase (s : string) : string = let is_first = ref true in let out = ref "" in CamomileLibraryDefault.Camomile.UTF8.iter (fun c -> let is_uppercase = Dcalc.Print.is_uppercase c in out := !out ^ (if is_uppercase && not !is_first then "_" else "") ^ String.lowercase_ascii (String.make 1 (CamomileLibraryDefault.Camomile.UChar.char_of c)); is_first := false) s; !out let to_uppercase (s : string) : string = let last_was_underscore = ref false in let is_first = ref true in let out = ref "" in CamomileLibraryDefault.Camomile.UTF8.iter (fun c -> let is_underscore = c = CamomileLibraryDefault.Camomile.UChar.of_char '_' in let c_string = String.make 1 (CamomileLibraryDefault.Camomile.UChar.char_of c) in out := !out ^ if is_underscore then "" else if !last_was_underscore || !is_first then String.uppercase_ascii c_string else c_string; last_was_underscore := is_underscore; is_first := false) s; !out
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>