Various convenience types and functions
An alias for OCaml's standard array type, used in generated code.
Read a biniou value from a channel.
Read a biniou value from a file.
Write a biniou value to a channel.
Type of a read_
function as produced by atdgen -json
.
In versions of yojson greater than 1.0.1,
type Yojson.Safe.lexer_state
is equivalent to
Yojson.lexer_state
, Yojson.Basic.lexer_state
and
Yojson.Raw.lexer_state
.
Read a JSON value from a lexbuf.
true
, the JSON parser will not try
to consume whitespace until the end of file.
Default is false
, which raises a Yojson.Json_error
exception if the valid JSON value is followed
by anything other than standard JSON whitespace.
Convert a JSON value from a string.
"<stdin>"
.
lnum=10
means that an error on the first
line of input will be reported as an error on line 10.
Default: 1.
Read a JSON value from a channel.
"<stdin>"
.
lnum=10
means that an error on the first
line of input will be reported as an error on line 10.
Default: 1.
Read a JSON value from a channel.
lnum=10
means that an error on the first
line of input will be reported as an error on line 10.
Default: 1.
Read a stream of JSON values from a lexbuf.
fun () -> close_in_noerr ic
.
Read a stream of JSON values from a channel. Values do not have to be separated by newline characters.
"<stdin>"
.
lnum=10
means that an error on the first
line of input will be reported as an error on line 10.
Default: 1.
Read a stream of JSON values from a channel. Values do not have to be separated by newline characters.
fun () -> close_in_noerr ic
.
"<stdin>"
.
lnum=10
means that an error on the first
line of input will be reported as an error on line 10.
Default: 1.
Read a stream of JSON values from a file. Values do not have to be separated by newline characters.
fun () -> Sys.remove fname
.
lnum=10
means that an error on the first
line of input will be reported as an error on line 10.
Default: 1.
Read a list of JSON values from a channel. Values do not have to be separated by newline characters.
"<stdin>"
.
lnum=10
means that an error on the first
line of input will be reported as an error on line 10.
Default: 1.
Read a list of JSON values from a channel. Values do not have to be separated by newline characters.
fun () -> close_in_noerr ic
.
"<stdin>"
.
lnum=10
means that an error on the first
line of input will be reported as an error on line 10.
Default: 1.
Read a list of JSON values from a file. Values do not have to be separated by newline characters.
lnum=10
means that an error on the first
line of input will be reported as an error on line 10.
Default: 1.
Write a JSON value to a string.
Write a JSON value to a channel.
Write a JSON value to a file.
Write a stream of values to a channel.
"\n"
.
Write a list of values to a string.
"\n"
.
Write a list of values to a channel.
"\n"
.
Write a list of values to a file.
"\n"
.
preset_unknown_field_handler src_loc field_name
raises a Failure
exception with a message containing
the location of the type definition in the source ATD file
(src_loc
) and the name of the field (field_name
).
Function called when an unknown JSON field is encountered if
the code was generated by atdgen -json-strict-fields.
Its preset behavior is to call preset_unknown_field_handler
which raises a Failure
exception.
Usage: !Ag_util.Json.unknown_field_handler src_loc field_name
where src_loc
is the location of the type definition
in the source ATD file and field_name
is the unknown
JSON field name.
preset_constr_mismatch_handler
constr_field constr_constr value_field value_constr
raises a Ag_oj_run.Error
exception with a message containing
the constructor field and value (constr_field
and constr_constr
)
which don't match the value field's (value_field
)
constructor (value_constr
).