From b3258fa774017710c8bf9a07fee1f7b302e9640c Mon Sep 17 00:00:00 2001 From: c-cube Date: Thu, 17 Apr 2025 21:00:57 +0000 Subject: [PATCH] deploy: 1b4c56b134753b1dde46d63e9ed838a15d029595 --- linol-lwt/_doc-dir/CHANGES.md | 7 +++++++ linol/_doc-dir/CHANGES.md | 7 +++++++ yojson/Yojson/index.html | 22 +++++++++++----------- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/linol-lwt/_doc-dir/CHANGES.md b/linol-lwt/_doc-dir/CHANGES.md index b8676724..82fbcdfd 100644 --- a/linol-lwt/_doc-dir/CHANGES.md +++ b/linol-lwt/_doc-dir/CHANGES.md @@ -1,4 +1,11 @@ +# 0.10 + +- use `git subtree` to vendor lsp+jsonrpc, so that they + are not dependencies anymore and do not conflict with + other users +- Add `filter_text_document` to ignore some documents + # 0.9 - Drop redundant dependency on atomic diff --git a/linol/_doc-dir/CHANGES.md b/linol/_doc-dir/CHANGES.md index b8676724..82fbcdfd 100644 --- a/linol/_doc-dir/CHANGES.md +++ b/linol/_doc-dir/CHANGES.md @@ -1,4 +1,11 @@ +# 0.10 + +- use `git subtree` to vendor lsp+jsonrpc, so that they + are not dependencies anymore and do not conflict with + other users +- Add `filter_text_document` to ignore some documents + # 0.9 - Drop redundant dependency on atomic diff --git a/yojson/Yojson/index.html b/yojson/Yojson/index.html index e8817a51..4505d922 100644 --- a/yojson/Yojson/index.html +++ b/yojson/Yojson/index.html @@ -1,51 +1,51 @@ -Yojson (yojson.Yojson)

Module Yojson

The Yojson library provides several types for representing JSON values, with different use cases.

Each of these different types have their own module.

Shared types and functions

val version : string
exception Json_error of string

Exception used:

  • in JSON readers, if parsing fails;
  • in JSON writers and pretty printing, if float value is not allowed in standard JSON.
val json_error : string -> 'a
type lexer_state = {
  1. buf : Stdlib.Buffer.t;
    (*

    Buffer used to accumulate substrings

    *)
  2. mutable lnum : int;
    (*

    Current line number (counting from 1)

    *)
  3. mutable bol : int;
    (*

    Absolute position of the first character of the current line (counting from 0)

    *)
  4. mutable fname : string option;
    (*

    Name referencing the input file in error messages

    *)
}
module Lexer_state : sig ... end
val init_lexer : +Yojson (yojson.Yojson)

Module Yojson

The Yojson library provides several types for representing JSON values, with different use cases.

  • The Basic JSON type,
  • The Safe JSON type, a superset of JSON with safer support for integers,
  • The Raw JSON type, a superset of JSON, safer but less integrated with OCaml types.

Each of these different types have their own module.

Shared types and functions

val version : string
exception Json_error of string
val json_error : string -> 'a
type lexer_state = {
  1. buf : Stdlib.Buffer.t;
  2. mutable lnum : int;
  3. mutable bol : int;
  4. mutable fname : string option;
}
module Lexer_state : sig ... end
val init_lexer : ?buf:Stdlib.Buffer.t -> ?fname:string -> ?lnum:int -> unit -> - lexer_state

Create a fresh lexer_state record.

Type of the JSON tree
type t = [
  1. | `Null
  2. | `Bool of bool
  3. | `Int of int
  4. | `Intlit of string
  5. | `Float of float
  6. | `Floatlit of string
  7. | `String of string
  8. | `Stringlit of string
  9. | `Assoc of (string * t) list
  10. | `List of t list
  11. | `Tuple of t list
  12. | `Variant of string * t option
]

All possible cases defined in Yojson:

  • `Null: JSON null
  • `Bool of bool: JSON boolean
  • `Int of int: JSON number without decimal point or exponent.
  • `Intlit of string: JSON number without decimal point or exponent, preserved as a string.
  • `Float of float: JSON number, Infinity, -Infinity or NaN.
  • `Floatlit of string: JSON number, Infinity, -Infinity or NaN, preserved as a string.
  • `String of string: JSON string. Bytes in the range 128-255 are preserved as-is without encoding validation for both reading and writing.
  • `Stringlit of string: JSON string literal including the double quotes.
  • `Assoc of (string * json) list: JSON object.
  • `List of json list: JSON array.
  • `Tuple of json list: Tuple (non-standard extension of JSON). Syntax: ("abc", 123).
  • `Variant of (string * json option): Variant (non-standard extension of JSON). Syntax: <"Foo"> or <"Bar":123>.
val pp : Stdlib.Format.formatter -> t -> unit

Pretty printer, useful for debugging

val show : t -> string

Convert value to string, useful for debugging

val equal : t -> t -> bool

equal a b is the monomorphic equality. Determines whether two JSON values are considered equal. In the case of JSON objects, the order of the keys does not matter, except for duplicate keys which will be considered equal as long as they are in the same input order.

JSON writers

val to_string : + lexer_state
exception End_of_array
exception End_of_object
exception End_of_tuple
exception End_of_input
type t = [
  1. | `Assoc of (string * t) list
  2. | `Bool of bool
  3. | `Float of float
  4. | `Floatlit of string
  5. | `Int of int
  6. | `Intlit of string
  7. | `List of t list
  8. | `Null
  9. | `String of string
  10. | `Stringlit of string
  11. | `Tuple of t list
  12. | `Variant of string * t option
]
val pp : Stdlib.Format.formatter -> t -> unit
val show : t -> string
val equal : t -> t -> bool
val to_string : ?buf:Stdlib.Buffer.t -> ?len:int -> ?suf:string -> ?std:bool -> t -> - string

Write a compact JSON value to a string.

  • parameter buf

    allows to reuse an existing buffer created with Buffer.create. The buffer is cleared of all contents before starting and right before returning.

  • parameter len

    initial length of the output buffer.

  • parameter suf

    appended to the output as a suffix, defaults to empty string.

  • parameter std

    use only standard JSON syntax, i.e. convert tuples and variants into standard JSON (if applicable), refuse to print NaN and infinities, require the root node to be either an object or an array. Default is false.

  • raises Json_error

    if float value is not allowed in standard JSON.

val to_channel : + string
val to_channel : ?buf:Stdlib.Buffer.t -> ?len:int -> ?suf:string -> ?std:bool -> - out_channel -> + Stdlib.out_channel -> t -> - unit

Write a compact JSON value to a channel. Note: the out_channel is not flushed by this function.

See to_string for the role of the optional arguments and raised exceptions.

val to_output : + unit
val to_output : ?buf:Stdlib.Buffer.t -> ?len:int -> ?suf:string -> ?std:bool -> < output : string -> int -> int -> int.. > -> t -> - unit

Write a compact JSON value to an OO channel.

See to_string for the role of the optional arguments and raised exceptions.

val to_file : ?len:int -> ?std:bool -> ?suf:string -> string -> t -> unit

Write a compact JSON value to a file. See to_string for the role of the optional arguments and raised exceptions.

  • parameter suf

    is a suffix appended to the output Newline by default for POSIX compliance.

val to_buffer : ?suf:string -> ?std:bool -> Stdlib.Buffer.t -> t -> unit

Write a compact JSON value to an existing buffer. See to_string for the role of the optional argument and raised exceptions.

val seq_to_string : + unit
val to_file : ?len:int -> ?std:bool -> ?suf:string -> string -> t -> unit
val to_buffer : ?suf:string -> ?std:bool -> Stdlib.Buffer.t -> t -> unit
val seq_to_string : ?buf:Stdlib.Buffer.t -> ?len:int -> ?suf:string -> ?std:bool -> t Stdlib.Seq.t -> - string

Write a sequence of suf-suffixed compact one-line JSON values to a string.

  • parameter suf

    is the suffix ouf each value written. Newline by default. See to_string for the role of the optional arguments and raised exceptions.

val seq_to_channel : + string
val seq_to_channel : ?buf:Stdlib.Buffer.t -> ?len:int -> ?suf:string -> ?std:bool -> - out_channel -> + Stdlib.out_channel -> t Stdlib.Seq.t -> - unit

Write a sequence of suf-suffixed compact one-line JSON values to a channel.

  • parameter suf

    is the suffix of each value written. Newline by default. See to_channel for the role of the optional arguments and raised exceptions.

val seq_to_file : + unit
val seq_to_file : ?len:int -> ?suf:string -> ?std:bool -> string -> t Stdlib.Seq.t -> - unit

Write a sequence of suf-suffixed compact one-line JSON values to a file.

  • parameter suf

    is the suffix of each value written. Newline by default. See to_string for the role of the optional arguments and raised exceptions.

val seq_to_buffer : + unit
val seq_to_buffer : ?suf:string -> ?std:bool -> Stdlib.Buffer.t -> t Stdlib.Seq.t -> - unit

Write a sequence of suf-suffixed compact one-line JSON values to an existing buffer.

  • parameter suf

    is the suffix of each value written. Newline by default. See to_string for the role of the optional arguments and raised exceptions.

val write_t : Stdlib.Buffer.t -> t -> unit

Write the given JSON value to the given buffer. Provided as a writer function for atdgen.

Miscellaneous

val sort : t -> t

Sort object fields (stable sort, comparing field names and treating them as byte sequences)

JSON pretty-printing

val pretty_print : ?std:bool -> Stdlib.Format.formatter -> t -> unit

Pretty-print into a Format.formatter. See to_string for the role of the optional std argument.

  • raises Json_error

    if float value is not allowed in standard JSON.

  • since 1.3.1
val pretty_to_string : ?std:bool -> t -> string

Pretty-print into a string. See to_string for the role of the optional std argument. See pretty_print for raised exceptions.

val pretty_to_channel : ?std:bool -> out_channel -> t -> unit

Pretty-print to a channel. See to_string for the role of the optional std argument. See pretty_print for raised exceptions.

Basic JSON tree type

module Basic : sig ... end

This module supports standard JSON nodes only, i.e. no special syntax for variants or tuples as supported by Yojson.Safe. Arbitrary integers are not supported as they must all fit within the standard OCaml int type (31 or 63 bits depending on the platform).

Multipurpose JSON tree type

module Safe : sig ... end

This module supports a specific syntax for variants and tuples in addition to the standard JSON nodes. Arbitrary integers are supported and represented as a decimal string using `Intlit when they cannot be represented using OCaml's int type (31 or 63 bits depending on the platform).

JSON tree type with literal int/float/string leaves

module Raw : sig ... end

Ints, floats and strings literals are systematically preserved using `Intlit, `Floatlit and `Stringlit. This module also supports the specific syntax for variants and tuples supported by Yojson.Safe.

Supertype of all JSON tree types

+ unit
val write_t : Stdlib.Buffer.t -> t -> unit
val sort : t -> t
val write_null : Stdlib.Buffer.t -> unit -> unit
val write_bool : Stdlib.Buffer.t -> bool -> unit
val write_int : Stdlib.Buffer.t -> int -> unit
val write_float : Stdlib.Buffer.t -> float -> unit
val write_std_float : Stdlib.Buffer.t -> float -> unit
val write_float_prec : int -> Stdlib.Buffer.t -> float -> unit
val write_std_float_prec : int -> Stdlib.Buffer.t -> float -> unit
val write_string : Stdlib.Buffer.t -> string -> unit
val write_intlit : Stdlib.Buffer.t -> string -> unit
val write_floatlit : Stdlib.Buffer.t -> string -> unit
val write_stringlit : Stdlib.Buffer.t -> string -> unit
val write_assoc : Stdlib.Buffer.t -> (string * t) list -> unit
val write_list : Stdlib.Buffer.t -> t list -> unit
val write_tuple : Stdlib.Buffer.t -> t list -> unit
val write_std_tuple : Stdlib.Buffer.t -> t list -> unit
val write_variant : Stdlib.Buffer.t -> string -> t option -> unit
val write_std_variant : Stdlib.Buffer.t -> string -> t option -> unit
val write_json : Stdlib.Buffer.t -> t -> unit
val write_std_json : Stdlib.Buffer.t -> t -> unit
val pretty_print : ?std:bool -> Stdlib.Format.formatter -> t -> unit
val pretty_to_string : ?std:bool -> t -> string
val pretty_to_channel : ?std:bool -> Stdlib.out_channel -> t -> unit

Basic JSON tree type

module Basic : sig ... end

This module supports standard JSON nodes only, i.e. no special syntax for variants or tuples as supported by Yojson.Safe. Arbitrary integers are not supported as they must all fit within the standard OCaml int type (31 or 63 bits depending on the platform).

Multipurpose JSON tree type

module Safe : sig ... end

This module supports a specific syntax for variants and tuples in addition to the standard JSON nodes. Arbitrary integers are supported and represented as a decimal string using `Intlit when they cannot be represented using OCaml's int type (31 or 63 bits depending on the platform).

JSON tree type with literal int/float/string leaves

module Raw : sig ... end

Ints, floats and strings literals are systematically preserved using `Intlit, `Floatlit and `Stringlit. This module also supports the specific syntax for variants and tuples supported by Yojson.Safe.

Supertype of all JSON tree types