Patrick Kelley 8fd444092b initial
2025-05-07 15:35:15 -04:00

944 lines
41 KiB
Plaintext

### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
module foo {
import hilti;
import spicy_rt;
type P0 = struct {
weak_ref<stream> __stream &internal &needed-by-feature="uses_stream";
iterator<stream> __begin &internal &needed-by-feature="uses_random_access";
optional<iterator<stream>> __position_update &internal &needed-by-feature="uses_random_access";
uint<64> __offset &internal &needed-by-feature="uses_offset";
spicy_rt::Parser __parser &static &internal &needed-by-feature="supports_filters" &needed-by-feature="supports_sinks";
spicy_rt::SinkState __sink &internal &needed-by-feature="supports_sinks";
strong_ref<spicy_rt::Filters> __filters &internal &needed-by-feature="supports_filters";
optional<hilti::RecoverableFailure> __error &always-emit &internal;
hook void __on_0x25_init();
hook void __on_0x25_done();
hook void __on_0x25_error(string __except);
hook optional<string> __hook_to_string();
hook void __on_0x25_finally();
hook void __on_0x25_confirmed() &needed-by-feature="synchronization";
hook void __on_0x25_rejected() &needed-by-feature="synchronization";
hook void __on_0x25_synced() &needed-by-feature="synchronization";
hook void __on_0x25_gap(uint<64> seq, uint<64> len);
hook void __on_0x25_overlap(uint<64> seq, bytes old, bytes new_);
hook void __on_0x25_skipped(uint<64> seq);
hook void __on_0x25_undelivered(uint<64> seq, bytes data);
hook void __on_0x25_sync_advance(uint<64> offset) &needed-by-feature="uses_sync_advance";
method tuple<const view<stream>, int<64>, const iterator<stream>, optional<hilti::RecoverableFailure>> __parse_stage1(inout value_ref<stream> __data, iterator<stream> __begin, copy view<stream> __cur, copy bool __trim, copy int<64> __lah, copy iterator<stream> __lahe, copy optional<hilti::RecoverableFailure> __error);
method view<stream> parse1(inout value_ref<stream> __data, optional<view<stream>> __cur = Null, optional<spicy_rt::UnitContext> __context) &needed-by-feature="is_filter" &needed-by-feature="supports_sinks" &static;
method view<stream> parse2(inout value_ref<P0> __unit, inout value_ref<stream> __data, optional<view<stream>> __cur = Null, optional<spicy_rt::UnitContext> __context) &needed-by-feature="is_filter" &needed-by-feature="supports_sinks" &static;
method view<stream> parse3(inout value_ref<spicy_rt::ParsedUnit> __gunit, inout value_ref<stream> __data, optional<view<stream>> __cur = Null, optional<spicy_rt::UnitContext> __context) &needed-by-feature="is_filter" &needed-by-feature="supports_sinks" &static;
method tuple<const view<stream>, int<64>, const iterator<stream>, optional<hilti::RecoverableFailure>> __parse_foo__P0_stage2(inout value_ref<stream> __data, iterator<stream> __begin, copy view<stream> __cur, copy bool __trim, copy int<64> __lah, copy iterator<stream> __lahe, copy optional<hilti::RecoverableFailure> __error);
} &on-heap;
public type P1 = struct {
weak_ref<const stream> __stream &internal &needed-by-feature="uses_stream";
iterator<stream> __begin &internal &needed-by-feature="uses_random_access";
optional<iterator<stream>> __position_update &internal &needed-by-feature="uses_random_access";
uint<64> __offset &internal &needed-by-feature="uses_offset";
spicy_rt::Parser __parser &static &internal &needed-by-feature="supports_filters" &always-emit;
spicy_rt::SinkState __sink &internal &needed-by-feature="supports_sinks";
strong_ref<spicy_rt::Filters> __filters &internal &needed-by-feature="supports_filters";
optional<hilti::RecoverableFailure> __error &always-emit &internal;
hook void __on_0x25_init();
hook void __on_0x25_done();
hook void __on_0x25_error(string __except);
hook optional<string> __hook_to_string();
hook void __on_0x25_finally();
hook void __on_0x25_confirmed() &needed-by-feature="synchronization";
hook void __on_0x25_rejected() &needed-by-feature="synchronization";
hook void __on_0x25_synced() &needed-by-feature="synchronization";
hook void __on_0x25_gap(uint<64> seq, uint<64> len);
hook void __on_0x25_overlap(uint<64> seq, bytes old, bytes new_);
hook void __on_0x25_skipped(uint<64> seq);
hook void __on_0x25_undelivered(uint<64> seq, bytes data);
hook void __on_0x25_sync_advance(uint<64> offset) &needed-by-feature="uses_sync_advance";
method tuple<const view<stream>, int<64>, const iterator<stream>, optional<hilti::RecoverableFailure>> __parse_stage1(inout value_ref<stream> __data, iterator<stream> __begin, copy view<stream> __cur, copy bool __trim, copy int<64> __lah, copy iterator<stream> __lahe, copy optional<hilti::RecoverableFailure> __error);
method view<stream> parse1(inout value_ref<stream> __data, optional<view<stream>> __cur = Null, optional<spicy_rt::UnitContext> __context) &needed-by-feature="is_filter" &needed-by-feature="supports_sinks" &static;
method view<stream> parse2(inout value_ref<P1> __unit, inout value_ref<stream> __data, optional<view<stream>> __cur = Null, optional<spicy_rt::UnitContext> __context) &needed-by-feature="is_filter" &needed-by-feature="supports_sinks" &static;
method view<stream> parse3(inout value_ref<spicy_rt::ParsedUnit> __gunit, inout value_ref<stream> __data, optional<view<stream>> __cur = Null, optional<spicy_rt::UnitContext> __context) &needed-by-feature="is_filter" &needed-by-feature="supports_sinks" &static;
method tuple<const view<stream>, int<64>, const iterator<stream>, optional<hilti::RecoverableFailure>> __parse_foo__P1_stage2(inout value_ref<stream> __data, iterator<stream> __begin, copy view<stream> __cur, copy bool __trim, copy int<64> __lah, copy iterator<stream> __lahe, copy optional<hilti::RecoverableFailure> __error);
} &on-heap;
public type P2 = struct {
uint<8> x &optional;
uint<8> y &optional;
weak_ref<const stream> __stream &internal &needed-by-feature="uses_stream";
iterator<stream> __begin &internal &needed-by-feature="uses_random_access";
optional<iterator<stream>> __position_update &internal &needed-by-feature="uses_random_access";
uint<64> __offset &internal &needed-by-feature="uses_offset";
spicy_rt::Parser __parser &static &internal &needed-by-feature="supports_filters" &always-emit;
spicy_rt::SinkState __sink &internal &needed-by-feature="supports_sinks";
strong_ref<spicy_rt::Filters> __filters &internal &needed-by-feature="supports_filters";
optional<hilti::RecoverableFailure> __error &always-emit &internal;
hook void __on_x(uint<8> __dd);
hook void __on_x_error(string __excpt);
hook void __on_y(uint<8> __dd);
hook void __on_y_error(string __excpt);
hook void __on_0x25_init();
hook void __on_0x25_done();
hook void __on_0x25_error(string __except);
hook optional<string> __hook_to_string();
hook void __on_0x25_finally();
hook void __on_0x25_confirmed() &needed-by-feature="synchronization";
hook void __on_0x25_rejected() &needed-by-feature="synchronization";
hook void __on_0x25_synced() &needed-by-feature="synchronization";
hook void __on_0x25_gap(uint<64> seq, uint<64> len);
hook void __on_0x25_overlap(uint<64> seq, bytes old, bytes new_);
hook void __on_0x25_skipped(uint<64> seq);
hook void __on_0x25_undelivered(uint<64> seq, bytes data);
hook void __on_0x25_sync_advance(uint<64> offset) &needed-by-feature="uses_sync_advance";
method tuple<const view<stream>, int<64>, const iterator<stream>, optional<hilti::RecoverableFailure>> __parse_stage1(inout value_ref<stream> __data, iterator<stream> __begin, copy view<stream> __cur, copy bool __trim, copy int<64> __lah, copy iterator<stream> __lahe, copy optional<hilti::RecoverableFailure> __error);
method view<stream> parse1(inout value_ref<stream> __data, optional<view<stream>> __cur = Null, optional<spicy_rt::UnitContext> __context) &needed-by-feature="is_filter" &needed-by-feature="supports_sinks" &static;
method view<stream> parse2(inout value_ref<P2> __unit, inout value_ref<stream> __data, optional<view<stream>> __cur = Null, optional<spicy_rt::UnitContext> __context) &needed-by-feature="is_filter" &needed-by-feature="supports_sinks" &static;
method view<stream> parse3(inout value_ref<spicy_rt::ParsedUnit> __gunit, inout value_ref<stream> __data, optional<view<stream>> __cur = Null, optional<spicy_rt::UnitContext> __context) &needed-by-feature="is_filter" &needed-by-feature="supports_sinks" &static;
method tuple<const view<stream>, int<64>, const iterator<stream>, optional<hilti::RecoverableFailure>> __parse_foo__P2_stage2(inout value_ref<stream> __data, iterator<stream> __begin, copy view<stream> __cur, copy bool __trim, copy int<64> __lah, copy iterator<stream> __lahe, copy optional<hilti::RecoverableFailure> __error);
} &on-heap;
const bool __feat%foo@@P0%uses_offset = True;
const bool __feat%foo@@P0%uses_random_access = True;
const bool __feat%foo@@P0%uses_stream = True;
const bool __feat%foo@@P0%uses_sync_advance = True;
const bool __feat%foo@@P0%is_filter = False;
const bool __feat%foo@@P0%supports_filters = True;
const bool __feat%foo@@P0%supports_sinks = True;
const bool __feat%foo@@P0%synchronization = True;
const bool __feat%foo@@P1%uses_offset = True;
const bool __feat%foo@@P1%uses_random_access = True;
const bool __feat%foo@@P1%uses_stream = True;
const bool __feat%foo@@P1%uses_sync_advance = True;
const bool __feat%foo@@P1%is_filter = False;
const bool __feat%foo@@P1%supports_filters = True;
const bool __feat%foo@@P1%supports_sinks = True;
const bool __feat%foo@@P1%synchronization = True;
const bool __feat%foo@@P2%uses_offset = True;
const bool __feat%foo@@P2%uses_random_access = True;
const bool __feat%foo@@P2%uses_stream = True;
const bool __feat%foo@@P2%uses_sync_advance = True;
const bool __feat%foo@@P2%is_filter = False;
const bool __feat%foo@@P2%supports_filters = True;
const bool __feat%foo@@P2%supports_sinks = True;
const bool __feat%foo@@P2%synchronization = True;
method method tuple<const view<stream>, int<64>, const iterator<stream>, optional<hilti::RecoverableFailure>> foo::P0::__parse_stage1(inout value_ref<stream> __data, iterator<stream> __begin, copy view<stream> __cur, copy bool __trim, copy int<64> __lah, copy iterator<stream> __lahe, copy optional<hilti::RecoverableFailure> __error) {
# "<...>/default-parser-functions.spicy:12:11-12:17"
local tuple<view<stream>, int<64>, const iterator<stream>, optional<hilti::RecoverableFailure>> __result = <void expression>;
try {
if ( ::__feat%foo@@P0%uses_random_access )
__trim = False;
hilti::debugIndent("spicy");
local iterator<stream> __begin = begin(__cur);
if ( ::__feat%foo@@P0%uses_stream )
(*self).__stream = __data;
if ( ::__feat%foo@@P0%uses_random_access )
(*self).__begin = __begin;
if ( ::__feat%foo@@P0%uses_offset )
(*self).__offset = cast<uint<64>>(begin(__cur).offset() - __begin.offset());
(*self).__error = __error;
if ( ::__feat%foo@@P0%uses_random_access || ::__feat%foo@@P0%uses_offset )
(*self).__position_update = Null;
(*self).__on_0x25_init();
if ( ::__feat%foo@@P0%uses_random_access || ::__feat%foo@@P0%uses_offset )
if ( (*self).__position_update ) {
__cur = __cur.advance((*(*self).__position_update));
(*self).__position_update = Null;
}
__error = (*self).__error;
local strong_ref<stream> filtered = Null;
if ( ::__feat%foo@@P0%supports_filters ) {
local uint<64> __offset1 = begin((*__data)).offset();
if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> __filtered_data = filtered;
self.__parse_foo__P0_stage2(__filtered_data, begin((*__filtered_data)), (*__filtered_data), __trim, __lah, __lahe, __error);
local uint<64> __offset2 = begin((*__data)).offset();
__cur = __cur.advance(__offset2 - __offset1);
if ( __trim )
(*__data).trim(begin(__cur));
__result = (__cur, __lah, __lahe, __error);
}
}
if ( ! filtered )
__result = (*self).__parse_foo__P0_stage2(__data, __begin, __cur, __trim, __lah, __lahe, __error);
}
catch ( hilti::SystemException __except ) {
if ( ::__feat%foo@@P0%uses_random_access )
(*self).__begin = __begin;
if ( ::__feat%foo@@P0%uses_offset )
(*self).__offset = cast<uint<64>>(begin(__cur).offset() - __begin.offset());
(*self).__on_0x25_error(hilti::exception_what(__except));
if ( ::__feat%foo@@P0%supports_filters )
spicy_rt::filter_disconnect(self);
if ( ::__feat%foo@@P0%supports_sinks )
(*self).__error = __error;
if ( ::__feat%foo@@P0%uses_random_access || ::__feat%foo@@P0%uses_offset )
(*self).__position_update = Null;
(*self).__on_0x25_finally();
if ( ::__feat%foo@@P0%uses_random_access || ::__feat%foo@@P0%uses_offset )
if ( (*self).__position_update ) {
__cur = __cur.advance((*(*self).__position_update));
(*self).__position_update = Null;
}
__error = (*self).__error;
throw;
}
(*self).__error = __error;
if ( ::__feat%foo@@P0%uses_random_access || ::__feat%foo@@P0%uses_offset )
(*self).__position_update = Null;
(*self).__on_0x25_finally();
if ( ::__feat%foo@@P0%uses_random_access || ::__feat%foo@@P0%uses_offset )
if ( (*self).__position_update ) {
__cur = __cur.advance((*(*self).__position_update));
(*self).__position_update = Null;
}
__error = (*self).__error;
return __result;
}
method method tuple<const view<stream>, int<64>, const iterator<stream>, optional<hilti::RecoverableFailure>> foo::P0::__parse_foo__P0_stage2(inout value_ref<stream> __data, iterator<stream> __begin, copy view<stream> __cur, copy bool __trim, copy int<64> __lah, copy iterator<stream> __lahe, copy optional<hilti::RecoverableFailure> __error) {
# "<...>/default-parser-functions.spicy:12:11-12:17"
local tuple<view<stream>, int<64>, const iterator<stream>, optional<hilti::RecoverableFailure>> __result = <void expression>;
if ( ::__feat%foo@@P0%uses_random_access )
(*self).__begin = __begin;
if ( ::__feat%foo@@P0%uses_offset )
(*self).__offset = cast<uint<64>>(begin(__cur).offset() - __begin.offset());
(*self).__error = __error;
if ( ::__feat%foo@@P0%uses_random_access || ::__feat%foo@@P0%uses_offset )
(*self).__position_update = Null;
(*self).__on_0x25_done();
if ( ::__feat%foo@@P0%uses_random_access || ::__feat%foo@@P0%uses_offset )
if ( (*self).__position_update ) {
__cur = __cur.advance((*(*self).__position_update));
(*self).__position_update = Null;
}
__error = (*self).__error;
if ( ::__feat%foo@@P0%supports_filters )
spicy_rt::filter_disconnect(self);
if ( ::__feat%foo@@P0%supports_sinks )
hilti::debugDedent("spicy");
__result = (__cur, __lah, __lahe, __error);
return __result;
}
method extern method view<stream> foo::P0::parse1(inout value_ref<stream> __data, optional<view<stream>> __cur = Null, optional<spicy_rt::UnitContext> __context) &needed-by-feature="is_filter" &needed-by-feature="supports_sinks" &static {
# "<...>/default-parser-functions.spicy:12:11-12:17"
local value_ref<P0> __unit = value_ref(default<const P0>());
local view<stream> __ncur = __cur ? (*__cur) : cast<view<stream>>((*__data));
local int<64> __lahead = 0;
local iterator<stream> __lahead_end;
local optional<hilti::RecoverableFailure> __error = Null;
# "<...>/default-parser-functions.spicy:12:11-12:17"
# Begin parsing production: Unit: foo__P0 ->
(__ncur, __lahead, __lahead_end, __error) = (*__unit).__parse_stage1(__data, begin(__ncur), __ncur, True, __lahead, __lahead_end, __error);
# End parsing production: Unit: foo__P0 ->
if ( ::__feat%foo@@P0%uses_random_access )
(*__unit).__begin = begin(__ncur);
if ( ::__feat%foo@@P0%uses_offset )
(*__unit).__offset = cast<uint<64>>(begin(__ncur).offset() - begin(__ncur).offset());
if ( __error )
throw exception("successful synchronization never confirmed: %s" % (hilti::exception_what((*__error))));
return __ncur;
}
method extern method view<stream> foo::P0::parse3(inout value_ref<spicy_rt::ParsedUnit> __gunit, inout value_ref<stream> __data, optional<view<stream>> __cur = Null, optional<spicy_rt::UnitContext> __context) &needed-by-feature="is_filter" &needed-by-feature="supports_sinks" &static {
# "<...>/default-parser-functions.spicy:12:11-12:17"
local value_ref<P0> __unit = value_ref(default<const P0>());
spicy_rt::initializeParsedUnit((*__gunit), __unit);
local view<stream> __ncur = __cur ? (*__cur) : cast<view<stream>>((*__data));
local int<64> __lahead = 0;
local iterator<stream> __lahead_end;
local optional<hilti::RecoverableFailure> __error = Null;
# "<...>/default-parser-functions.spicy:12:11-12:17"
# Begin parsing production: Unit: foo__P0 ->
(__ncur, __lahead, __lahead_end, __error) = (*__unit).__parse_stage1(__data, begin(__ncur), __ncur, True, __lahead, __lahead_end, __error);
# End parsing production: Unit: foo__P0 ->
if ( ::__feat%foo@@P0%uses_random_access )
(*__unit).__begin = begin(__ncur);
if ( ::__feat%foo@@P0%uses_offset )
(*__unit).__offset = cast<uint<64>>(begin(__ncur).offset() - begin(__ncur).offset());
if ( __error )
throw exception("successful synchronization never confirmed: %s" % (hilti::exception_what((*__error))));
return __ncur;
}
method extern method view<stream> foo::P0::parse2(inout value_ref<P0> __unit, inout value_ref<stream> __data, optional<view<stream>> __cur = Null, optional<spicy_rt::UnitContext> __context) &needed-by-feature="is_filter" &needed-by-feature="supports_sinks" &static {
# "<...>/default-parser-functions.spicy:12:11-12:17"
local view<stream> __ncur = __cur ? (*__cur) : cast<view<stream>>((*__data));
local int<64> __lahead = 0;
local iterator<stream> __lahead_end;
local optional<hilti::RecoverableFailure> __error = Null;
# "<...>/default-parser-functions.spicy:12:11-12:17"
# Begin parsing production: Unit: foo__P0 ->
(__ncur, __lahead, __lahead_end, __error) = (*__unit).__parse_stage1(__data, begin(__ncur), __ncur, True, __lahead, __lahead_end, __error);
# End parsing production: Unit: foo__P0 ->
if ( ::__feat%foo@@P0%uses_random_access )
(*__unit).__begin = begin(__ncur);
if ( ::__feat%foo@@P0%uses_offset )
(*__unit).__offset = cast<uint<64>>(begin(__ncur).offset() - begin(__ncur).offset());
if ( __error )
throw exception("successful synchronization never confirmed: %s" % (hilti::exception_what((*__error))));
return __ncur;
}
init function void __register_foo_P0() {
if ( ::__feat%foo@@P0%is_filter || ::__feat%foo@@P0%supports_sinks ) {
foo::P0::__parser = [$name="foo::P0", $is_public=False, $parse1=foo::P0::parse1, $parse2=foo::P0::parse2, $parse3=foo::P0::parse3, $context_new=Null, $type_=P0, $description="", $mime_types=vector(), $ports=vector()];
spicy_rt::registerParser(foo::P0::__parser, $scope, Null);
}
}
method method tuple<const view<stream>, int<64>, const iterator<stream>, optional<hilti::RecoverableFailure>> foo::P1::__parse_stage1(inout value_ref<stream> __data, iterator<stream> __begin, copy view<stream> __cur, copy bool __trim, copy int<64> __lah, copy iterator<stream> __lahe, copy optional<hilti::RecoverableFailure> __error) {
# "<...>/default-parser-functions.spicy:14:18-14:24"
local tuple<view<stream>, int<64>, const iterator<stream>, optional<hilti::RecoverableFailure>> __result = <void expression>;
try {
if ( ::__feat%foo@@P1%uses_random_access )
__trim = False;
hilti::debugIndent("spicy");
local iterator<stream> __begin = begin(__cur);
if ( ::__feat%foo@@P1%uses_stream )
(*self).__stream = __data;
if ( ::__feat%foo@@P1%uses_random_access )
(*self).__begin = __begin;
if ( ::__feat%foo@@P1%uses_offset )
(*self).__offset = cast<uint<64>>(begin(__cur).offset() - __begin.offset());
(*self).__error = __error;
if ( ::__feat%foo@@P1%uses_random_access || ::__feat%foo@@P1%uses_offset )
(*self).__position_update = Null;
(*self).__on_0x25_init();
if ( ::__feat%foo@@P1%uses_random_access || ::__feat%foo@@P1%uses_offset )
if ( (*self).__position_update ) {
__cur = __cur.advance((*(*self).__position_update));
(*self).__position_update = Null;
}
__error = (*self).__error;
local strong_ref<stream> filtered = Null;
if ( ::__feat%foo@@P1%supports_filters ) {
local uint<64> __offset1 = begin((*__data)).offset();
if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> __filtered_data = filtered;
self.__parse_foo__P1_stage2(__filtered_data, begin((*__filtered_data)), (*__filtered_data), __trim, __lah, __lahe, __error);
local uint<64> __offset2 = begin((*__data)).offset();
__cur = __cur.advance(__offset2 - __offset1);
if ( __trim )
(*__data).trim(begin(__cur));
__result = (__cur, __lah, __lahe, __error);
}
}
if ( ! filtered )
__result = (*self).__parse_foo__P1_stage2(__data, __begin, __cur, __trim, __lah, __lahe, __error);
}
catch ( hilti::SystemException __except ) {
if ( ::__feat%foo@@P1%uses_random_access )
(*self).__begin = __begin;
if ( ::__feat%foo@@P1%uses_offset )
(*self).__offset = cast<uint<64>>(begin(__cur).offset() - __begin.offset());
(*self).__on_0x25_error(hilti::exception_what(__except));
if ( ::__feat%foo@@P1%supports_filters )
spicy_rt::filter_disconnect(self);
if ( ::__feat%foo@@P1%supports_sinks )
(*self).__error = __error;
if ( ::__feat%foo@@P1%uses_random_access || ::__feat%foo@@P1%uses_offset )
(*self).__position_update = Null;
(*self).__on_0x25_finally();
if ( ::__feat%foo@@P1%uses_random_access || ::__feat%foo@@P1%uses_offset )
if ( (*self).__position_update ) {
__cur = __cur.advance((*(*self).__position_update));
(*self).__position_update = Null;
}
__error = (*self).__error;
throw;
}
(*self).__error = __error;
if ( ::__feat%foo@@P1%uses_random_access || ::__feat%foo@@P1%uses_offset )
(*self).__position_update = Null;
(*self).__on_0x25_finally();
if ( ::__feat%foo@@P1%uses_random_access || ::__feat%foo@@P1%uses_offset )
if ( (*self).__position_update ) {
__cur = __cur.advance((*(*self).__position_update));
(*self).__position_update = Null;
}
__error = (*self).__error;
return __result;
}
method method tuple<const view<stream>, int<64>, const iterator<stream>, optional<hilti::RecoverableFailure>> foo::P1::__parse_foo__P1_stage2(inout value_ref<stream> __data, iterator<stream> __begin, copy view<stream> __cur, copy bool __trim, copy int<64> __lah, copy iterator<stream> __lahe, copy optional<hilti::RecoverableFailure> __error) {
# "<...>/default-parser-functions.spicy:14:18-14:24"
local tuple<view<stream>, int<64>, const iterator<stream>, optional<hilti::RecoverableFailure>> __result = <void expression>;
if ( ::__feat%foo@@P1%uses_random_access )
(*self).__begin = __begin;
if ( ::__feat%foo@@P1%uses_offset )
(*self).__offset = cast<uint<64>>(begin(__cur).offset() - __begin.offset());
(*self).__error = __error;
if ( ::__feat%foo@@P1%uses_random_access || ::__feat%foo@@P1%uses_offset )
(*self).__position_update = Null;
(*self).__on_0x25_done();
if ( ::__feat%foo@@P1%uses_random_access || ::__feat%foo@@P1%uses_offset )
if ( (*self).__position_update ) {
__cur = __cur.advance((*(*self).__position_update));
(*self).__position_update = Null;
}
__error = (*self).__error;
if ( ::__feat%foo@@P1%supports_filters )
spicy_rt::filter_disconnect(self);
if ( ::__feat%foo@@P1%supports_sinks )
hilti::debugDedent("spicy");
__result = (__cur, __lah, __lahe, __error);
return __result;
}
method extern method view<stream> foo::P1::parse1(inout value_ref<stream> __data, optional<view<stream>> __cur = Null, optional<spicy_rt::UnitContext> __context) &needed-by-feature="is_filter" &needed-by-feature="supports_sinks" &static {
# "<...>/default-parser-functions.spicy:14:18-14:24"
local value_ref<P1> __unit = value_ref(default<const P1>());
local view<stream> __ncur = __cur ? (*__cur) : cast<view<stream>>((*__data));
local int<64> __lahead = 0;
local iterator<stream> __lahead_end;
local optional<hilti::RecoverableFailure> __error = Null;
# "<...>/default-parser-functions.spicy:14:18-14:24"
# Begin parsing production: Unit: foo__P1 ->
(__ncur, __lahead, __lahead_end, __error) = (*__unit).__parse_stage1(__data, begin(__ncur), __ncur, True, __lahead, __lahead_end, __error);
# End parsing production: Unit: foo__P1 ->
if ( ::__feat%foo@@P1%uses_random_access )
(*__unit).__begin = begin(__ncur);
if ( ::__feat%foo@@P1%uses_offset )
(*__unit).__offset = cast<uint<64>>(begin(__ncur).offset() - begin(__ncur).offset());
if ( __error )
throw exception("successful synchronization never confirmed: %s" % (hilti::exception_what((*__error))));
return __ncur;
}
method extern method view<stream> foo::P1::parse3(inout value_ref<spicy_rt::ParsedUnit> __gunit, inout value_ref<stream> __data, optional<view<stream>> __cur = Null, optional<spicy_rt::UnitContext> __context) &needed-by-feature="is_filter" &needed-by-feature="supports_sinks" &static {
# "<...>/default-parser-functions.spicy:14:18-14:24"
local value_ref<P1> __unit = value_ref(default<const P1>());
spicy_rt::initializeParsedUnit((*__gunit), __unit);
local view<stream> __ncur = __cur ? (*__cur) : cast<view<stream>>((*__data));
local int<64> __lahead = 0;
local iterator<stream> __lahead_end;
local optional<hilti::RecoverableFailure> __error = Null;
# "<...>/default-parser-functions.spicy:14:18-14:24"
# Begin parsing production: Unit: foo__P1 ->
(__ncur, __lahead, __lahead_end, __error) = (*__unit).__parse_stage1(__data, begin(__ncur), __ncur, True, __lahead, __lahead_end, __error);
# End parsing production: Unit: foo__P1 ->
if ( ::__feat%foo@@P1%uses_random_access )
(*__unit).__begin = begin(__ncur);
if ( ::__feat%foo@@P1%uses_offset )
(*__unit).__offset = cast<uint<64>>(begin(__ncur).offset() - begin(__ncur).offset());
if ( __error )
throw exception("successful synchronization never confirmed: %s" % (hilti::exception_what((*__error))));
return __ncur;
}
method extern method view<stream> foo::P1::parse2(inout value_ref<P1> __unit, inout value_ref<stream> __data, optional<view<stream>> __cur = Null, optional<spicy_rt::UnitContext> __context) &needed-by-feature="is_filter" &needed-by-feature="supports_sinks" &static {
# "<...>/default-parser-functions.spicy:14:18-14:24"
local view<stream> __ncur = __cur ? (*__cur) : cast<view<stream>>((*__data));
local int<64> __lahead = 0;
local iterator<stream> __lahead_end;
local optional<hilti::RecoverableFailure> __error = Null;
# "<...>/default-parser-functions.spicy:14:18-14:24"
# Begin parsing production: Unit: foo__P1 ->
(__ncur, __lahead, __lahead_end, __error) = (*__unit).__parse_stage1(__data, begin(__ncur), __ncur, True, __lahead, __lahead_end, __error);
# End parsing production: Unit: foo__P1 ->
if ( ::__feat%foo@@P1%uses_random_access )
(*__unit).__begin = begin(__ncur);
if ( ::__feat%foo@@P1%uses_offset )
(*__unit).__offset = cast<uint<64>>(begin(__ncur).offset() - begin(__ncur).offset());
if ( __error )
throw exception("successful synchronization never confirmed: %s" % (hilti::exception_what((*__error))));
return __ncur;
}
init function void __register_foo_P1() {
foo::P1::__parser = [$name="foo::P1", $is_public=True, $parse1=foo::P1::parse1, $parse2=foo::P1::parse2, $parse3=foo::P1::parse3, $context_new=Null, $type_=P1, $description="", $mime_types=vector(), $ports=vector()];
spicy_rt::registerParser(foo::P1::__parser, $scope, Null);
}
method hook void foo::P2::__on_y(uint<8> __dd) {
}
method hook void foo::P2::__on_0x25_error(string __except) {
}
method method tuple<const view<stream>, int<64>, const iterator<stream>, optional<hilti::RecoverableFailure>> foo::P2::__parse_stage1(inout value_ref<stream> __data, iterator<stream> __begin, copy view<stream> __cur, copy bool __trim, copy int<64> __lah, copy iterator<stream> __lahe, copy optional<hilti::RecoverableFailure> __error) {
# "<...>/default-parser-functions.spicy:16:18-21:1"
local tuple<view<stream>, int<64>, const iterator<stream>, optional<hilti::RecoverableFailure>> __result = <void expression>;
try {
if ( ::__feat%foo@@P2%uses_random_access )
__trim = False;
hilti::debugIndent("spicy");
local iterator<stream> __begin = begin(__cur);
if ( ::__feat%foo@@P2%uses_stream )
(*self).__stream = __data;
if ( ::__feat%foo@@P2%uses_random_access )
(*self).__begin = __begin;
if ( ::__feat%foo@@P2%uses_offset )
(*self).__offset = cast<uint<64>>(begin(__cur).offset() - __begin.offset());
(*self).__error = __error;
if ( ::__feat%foo@@P2%uses_random_access || ::__feat%foo@@P2%uses_offset )
(*self).__position_update = Null;
(*self).__on_0x25_init();
if ( ::__feat%foo@@P2%uses_random_access || ::__feat%foo@@P2%uses_offset )
if ( (*self).__position_update ) {
__cur = __cur.advance((*(*self).__position_update));
(*self).__position_update = Null;
}
__error = (*self).__error;
local strong_ref<stream> filtered = Null;
if ( ::__feat%foo@@P2%supports_filters ) {
local uint<64> __offset1 = begin((*__data)).offset();
if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> __filtered_data = filtered;
self.__parse_foo__P2_stage2(__filtered_data, begin((*__filtered_data)), (*__filtered_data), __trim, __lah, __lahe, __error);
local uint<64> __offset2 = begin((*__data)).offset();
__cur = __cur.advance(__offset2 - __offset1);
if ( __trim )
(*__data).trim(begin(__cur));
__result = (__cur, __lah, __lahe, __error);
}
}
if ( ! filtered )
__result = (*self).__parse_foo__P2_stage2(__data, __begin, __cur, __trim, __lah, __lahe, __error);
}
catch ( hilti::SystemException __except ) {
if ( ::__feat%foo@@P2%uses_random_access )
(*self).__begin = __begin;
if ( ::__feat%foo@@P2%uses_offset )
(*self).__offset = cast<uint<64>>(begin(__cur).offset() - __begin.offset());
(*self).__on_0x25_error(hilti::exception_what(__except));
if ( ::__feat%foo@@P2%supports_filters )
spicy_rt::filter_disconnect(self);
if ( ::__feat%foo@@P2%supports_sinks )
(*self).__error = __error;
if ( ::__feat%foo@@P2%uses_random_access || ::__feat%foo@@P2%uses_offset )
(*self).__position_update = Null;
(*self).__on_0x25_finally();
if ( ::__feat%foo@@P2%uses_random_access || ::__feat%foo@@P2%uses_offset )
if ( (*self).__position_update ) {
__cur = __cur.advance((*(*self).__position_update));
(*self).__position_update = Null;
}
__error = (*self).__error;
throw;
}
(*self).__error = __error;
if ( ::__feat%foo@@P2%uses_random_access || ::__feat%foo@@P2%uses_offset )
(*self).__position_update = Null;
(*self).__on_0x25_finally();
if ( ::__feat%foo@@P2%uses_random_access || ::__feat%foo@@P2%uses_offset )
if ( (*self).__position_update ) {
__cur = __cur.advance((*(*self).__position_update));
(*self).__position_update = Null;
}
__error = (*self).__error;
return __result;
}
method method tuple<const view<stream>, int<64>, const iterator<stream>, optional<hilti::RecoverableFailure>> foo::P2::__parse_foo__P2_stage2(inout value_ref<stream> __data, iterator<stream> __begin, copy view<stream> __cur, copy bool __trim, copy int<64> __lah, copy iterator<stream> __lahe, copy optional<hilti::RecoverableFailure> __error) {
# "<...>/default-parser-functions.spicy:16:18-21:1"
local tuple<view<stream>, int<64>, const iterator<stream>, optional<hilti::RecoverableFailure>> __result = <void expression>;
try {
# "<...>/default-parser-functions.spicy:17:8-17:12"
# Begin parsing production: Variable: x -> uint<8>
spicy_rt::waitForInput(__data, __cur, 1, "expecting 1 bytes for unpacking value", "<...>/default-parser-functions.spicy:17:8-17:12", ::__feat%foo@@P2%supports_filters ? (*self).__filters : Null);
((*self).x, __cur) = (*unpack<uint<8>>((__cur, hilti::ByteOrder::Network)));
if ( __trim )
(*__data).trim(begin(__cur));
# End parsing production: Variable: x -> uint<8>
(*self).__error = __error;
if ( ::__feat%foo@@P2%uses_random_access || ::__feat%foo@@P2%uses_offset )
(*self).__position_update = Null;
(*self).__on_x((*self).x);
if ( ::__feat%foo@@P2%uses_random_access || ::__feat%foo@@P2%uses_offset )
if ( (*self).__position_update ) {
__cur = __cur.advance((*(*self).__position_update));
(*self).__position_update = Null;
}
__error = (*self).__error;
}
catch ( hilti::SystemException __except ) {
(*self).__on_x_error(hilti::exception_what(__except));
throw;
}
if ( ::__feat%foo@@P2%uses_random_access )
(*self).__begin = __begin;
if ( ::__feat%foo@@P2%uses_offset )
(*self).__offset = cast<uint<64>>(begin(__cur).offset() - __begin.offset());
try {
# "<...>/default-parser-functions.spicy:18:8-18:12"
# Begin parsing production: Variable: y -> uint<8>
spicy_rt::waitForInput(__data, __cur, 1, "expecting 1 bytes for unpacking value", "<...>/default-parser-functions.spicy:18:8-18:12", ::__feat%foo@@P2%supports_filters ? (*self).__filters : Null);
((*self).y, __cur) = (*unpack<uint<8>>((__cur, hilti::ByteOrder::Network)));
if ( __trim )
(*__data).trim(begin(__cur));
# End parsing production: Variable: y -> uint<8>
(*self).__error = __error;
if ( ::__feat%foo@@P2%uses_random_access || ::__feat%foo@@P2%uses_offset )
(*self).__position_update = Null;
(*self).__on_y((*self).y);
if ( ::__feat%foo@@P2%uses_random_access || ::__feat%foo@@P2%uses_offset )
if ( (*self).__position_update ) {
__cur = __cur.advance((*(*self).__position_update));
(*self).__position_update = Null;
}
__error = (*self).__error;
}
catch ( hilti::SystemException __except ) {
(*self).__on_y_error(hilti::exception_what(__except));
throw;
}
if ( ::__feat%foo@@P2%uses_random_access )
(*self).__begin = __begin;
if ( ::__feat%foo@@P2%uses_offset )
(*self).__offset = cast<uint<64>>(begin(__cur).offset() - __begin.offset());
if ( ::__feat%foo@@P2%uses_random_access )
(*self).__begin = __begin;
if ( ::__feat%foo@@P2%uses_offset )
(*self).__offset = cast<uint<64>>(begin(__cur).offset() - __begin.offset());
(*self).__error = __error;
if ( ::__feat%foo@@P2%uses_random_access || ::__feat%foo@@P2%uses_offset )
(*self).__position_update = Null;
(*self).__on_0x25_done();
if ( ::__feat%foo@@P2%uses_random_access || ::__feat%foo@@P2%uses_offset )
if ( (*self).__position_update ) {
__cur = __cur.advance((*(*self).__position_update));
(*self).__position_update = Null;
}
__error = (*self).__error;
if ( ::__feat%foo@@P2%supports_filters )
spicy_rt::filter_disconnect(self);
if ( ::__feat%foo@@P2%supports_sinks )
hilti::debugDedent("spicy");
__result = (__cur, __lah, __lahe, __error);
return __result;
}
method extern method view<stream> foo::P2::parse1(inout value_ref<stream> __data, optional<view<stream>> __cur = Null, optional<spicy_rt::UnitContext> __context) &needed-by-feature="is_filter" &needed-by-feature="supports_sinks" &static {
# "<...>/default-parser-functions.spicy:16:18-21:1"
local value_ref<P2> __unit = value_ref(default<const P2>());
local view<stream> __ncur = __cur ? (*__cur) : cast<view<stream>>((*__data));
local int<64> __lahead = 0;
local iterator<stream> __lahead_end;
local optional<hilti::RecoverableFailure> __error = Null;
# "<...>/default-parser-functions.spicy:16:18-21:1"
# Begin parsing production: Unit: foo__P2 -> x y
(__ncur, __lahead, __lahead_end, __error) = (*__unit).__parse_stage1(__data, begin(__ncur), __ncur, True, __lahead, __lahead_end, __error);
# End parsing production: Unit: foo__P2 -> x y
if ( ::__feat%foo@@P2%uses_random_access )
(*__unit).__begin = begin(__ncur);
if ( ::__feat%foo@@P2%uses_offset )
(*__unit).__offset = cast<uint<64>>(begin(__ncur).offset() - begin(__ncur).offset());
if ( __error )
throw exception("successful synchronization never confirmed: %s" % (hilti::exception_what((*__error))));
return __ncur;
}
method extern method view<stream> foo::P2::parse3(inout value_ref<spicy_rt::ParsedUnit> __gunit, inout value_ref<stream> __data, optional<view<stream>> __cur = Null, optional<spicy_rt::UnitContext> __context) &needed-by-feature="is_filter" &needed-by-feature="supports_sinks" &static {
# "<...>/default-parser-functions.spicy:16:18-21:1"
local value_ref<P2> __unit = value_ref(default<const P2>());
spicy_rt::initializeParsedUnit((*__gunit), __unit);
local view<stream> __ncur = __cur ? (*__cur) : cast<view<stream>>((*__data));
local int<64> __lahead = 0;
local iterator<stream> __lahead_end;
local optional<hilti::RecoverableFailure> __error = Null;
# "<...>/default-parser-functions.spicy:16:18-21:1"
# Begin parsing production: Unit: foo__P2 -> x y
(__ncur, __lahead, __lahead_end, __error) = (*__unit).__parse_stage1(__data, begin(__ncur), __ncur, True, __lahead, __lahead_end, __error);
# End parsing production: Unit: foo__P2 -> x y
if ( ::__feat%foo@@P2%uses_random_access )
(*__unit).__begin = begin(__ncur);
if ( ::__feat%foo@@P2%uses_offset )
(*__unit).__offset = cast<uint<64>>(begin(__ncur).offset() - begin(__ncur).offset());
if ( __error )
throw exception("successful synchronization never confirmed: %s" % (hilti::exception_what((*__error))));
return __ncur;
}
method extern method view<stream> foo::P2::parse2(inout value_ref<P2> __unit, inout value_ref<stream> __data, optional<view<stream>> __cur = Null, optional<spicy_rt::UnitContext> __context) &needed-by-feature="is_filter" &needed-by-feature="supports_sinks" &static {
# "<...>/default-parser-functions.spicy:16:18-21:1"
local view<stream> __ncur = __cur ? (*__cur) : cast<view<stream>>((*__data));
local int<64> __lahead = 0;
local iterator<stream> __lahead_end;
local optional<hilti::RecoverableFailure> __error = Null;
# "<...>/default-parser-functions.spicy:16:18-21:1"
# Begin parsing production: Unit: foo__P2 -> x y
(__ncur, __lahead, __lahead_end, __error) = (*__unit).__parse_stage1(__data, begin(__ncur), __ncur, True, __lahead, __lahead_end, __error);
# End parsing production: Unit: foo__P2 -> x y
if ( ::__feat%foo@@P2%uses_random_access )
(*__unit).__begin = begin(__ncur);
if ( ::__feat%foo@@P2%uses_offset )
(*__unit).__offset = cast<uint<64>>(begin(__ncur).offset() - begin(__ncur).offset());
if ( __error )
throw exception("successful synchronization never confirmed: %s" % (hilti::exception_what((*__error))));
return __ncur;
}
init function void __register_foo_P2() {
foo::P2::__parser = [$name="foo::P2", $is_public=True, $parse1=foo::P2::parse1, $parse2=foo::P2::parse2, $parse3=foo::P2::parse3, $context_new=Null, $type_=P2, $description="", $mime_types=vector(), $ports=vector()];
spicy_rt::registerParser(foo::P2::__parser, $scope, Null);
}
}