-module(bison@custom). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]). -export([to_bit_array_with_code/1, from_bit_array_with_code/2]). -export_type([custom/0]). -opaque custom() :: {custom, bitstring(), bitstring()}. -spec to_bit_array_with_code(custom()) -> {integer(), bitstring()}. to_bit_array_with_code(Custom) -> case Custom of {custom, <>, Value} -> {Code, Value} end. -spec from_bit_array_with_code(integer(), bitstring()) -> {ok, custom()} | {error, nil}. from_bit_array_with_code(Code, Value) -> case (Code =< 16#ff) andalso (Code >= 16#80) of true -> {ok, {custom, <>, Value}}; false -> {error, nil} end.