Current section
Files
Jump to
Current section
Files
src/htmgrrrl.erl
-module(htmgrrrl).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/htmgrrrl.gleam").
-export([sax/3]).
-export_type([sax_event/0, attribute/0]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
-type sax_event() :: start_document |
end_document |
{start_prefix_mapping, binary(), binary()} |
{end_prefix_mapping, binary()} |
{start_element, binary(), binary(), {binary(), binary()}, list(attribute())} |
{end_element, binary(), binary(), {binary(), binary()}} |
{characters, binary()} |
{ignorable_whitespace, binary()} |
{processing_instruction, binary(), binary()} |
{comment, binary()} |
start_cdata |
end_cdata |
{start_dtd, binary(), binary(), binary()} |
end_dtd |
{element_decl, binary(), binary()} |
{attribute_declaration, binary(), binary(), binary(), binary(), binary()} |
{internal_entity_declaration, binary(), binary()} |
{external_entity_declaration, binary(), binary(), binary()} |
{unparsed_entity_declaration, binary(), binary(), binary(), binary()} |
{notation_declaration, binary(), binary(), binary()}.
-type attribute() :: {attribute, binary(), binary(), binary(), binary()}.
-file("src/htmgrrrl.gleam", 125).
?DOC(
" Iterate over a stream of SAX events, calling the given function for each\n"
" event.\n"
"\n"
" The given function takes the current state, the line number of the event,\n"
" and the event itself, and returns the new state. The final state is\n"
" returned.\n"
).
-spec sax(binary(), DKT, fun((DKT, integer(), sax_event()) -> DKT)) -> {ok, DKT} |
{error, nil}.
sax(A, B, C) ->
htmgrrrl_ffi:sax(A, B, C).