package catala

  1. Overview
  2. Docs
Compiler and library for the literate programming language for tax code specification

Install

Dune Dependency

Authors

Maintainers

Sources

0.9.0.tar.gz
md5=8f891209d18b6540df9c34b2d1a6a783
sha512=737770b87a057674bceefe77e8526720732552f51f424afcebcb6a628267eab522c4fd993caca1ae8ed7ace65a4a87e485af10c1676e51ca5939509a1b841ac2

doc/catala.catala_utils/Catala_utils/Message/index.html

Module Catala_utils.MessageSource

Interface for emitting compiler messages.

All messages are expected to use the Format module. Flush, "@?", "@.", "%!" etc. are not supposed to be used outside of this module.

WARNING: this module performs side-effects at load time, adding support for ocolor tags (e.g. "@{<blue>text@}") to the standard string formatter used by e.g. Format.sprintf. (In this case, the tags are ignored, for color output you should use the functions of this module that toggle support depending on cli flags and terminal support).

Message content

Sourcetype content_type =
  1. | Error
  2. | Warning
  3. | Debug
  4. | Log
  5. | Result
Sourcemodule Content : sig ... end

This functions emits the message according to the emission type defined by Cli.message_format_flag.

Error exception

Sourceexception CompilerError of Content.t

Common error raising

Sourceval raise_spanned_error : ?span_msg:Content.message -> ?suggestion:string list -> Pos.t -> ('a, Format.formatter, unit, 'b) format4 -> 'a
Sourceval raise_multispanned_error_full : ?suggestion:string list -> (Content.message option * Pos.t) list -> ('a, Format.formatter, unit, 'b) format4 -> 'a
Sourceval raise_multispanned_error : ?suggestion:string list -> (string option * Pos.t) list -> ('a, Format.formatter, unit, 'b) format4 -> 'a
Sourceval raise_error : ('a, Format.formatter, unit, 'b) format4 -> 'a
Sourceval raise_internal_error : ('a, Format.formatter, unit, 'b) format4 -> 'a
Sourceval assert_internal_error : bool -> ('a, Format.formatter, unit, unit, unit, unit) format6 -> 'a

Common warning emission

Sourceval emit_multispanned_warning : (Content.message option * Pos.t) list -> ('a, Format.formatter, unit) format -> 'a
Sourceval emit_spanned_warning : ?span_msg:Content.message -> Pos.t -> ('a, Format.formatter, unit) format -> 'a
Sourceval emit_warning : ('a, Format.formatter, unit) format -> 'a

Common log emission

Sourceval emit_log : ('a, Format.formatter, unit) format -> 'a

Common debug emission

Sourceval emit_debug : ('a, Format.formatter, unit) format -> 'a

Common result emission

Sourceval emit_result : ('a, Format.formatter, unit) format -> 'a

Some formatting helpers

Sourceval unformat : (Format.formatter -> unit) -> string

Converts f to a string, discarding formatting and skipping newlines and indents

Sourceval has_color : out_channel -> bool
Sourceval formatter_of_out_channel : out_channel -> Format.formatter

Creates a new formatter from the given out channel, with correct handling of the ocolor tags. Actual use of escape codes in the output depends on Cli.style_flag -- and wether the channel is a tty if that is set to auto.

OCaml

Innovation. Community. Security.