271 lines
16 KiB
Plaintext
271 lines
16 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;
|
|
|
|
public type P1 = struct {
|
|
spicy_rt::Parser __parser &static &internal &needed-by-feature="supports_filters" &always-emit;
|
|
optional<hilti::RecoverableFailure> __error &always-emit &internal;
|
|
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;
|
|
spicy_rt::Parser __parser &static &internal &needed-by-feature="supports_filters" &always-emit;
|
|
optional<hilti::RecoverableFailure> __error &always-emit &internal;
|
|
hook void __on_y(uint<8> __dd);
|
|
hook void __on_0x25_error(string __except);
|
|
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 = False;
|
|
const bool __feat%foo@@P0%uses_random_access = False;
|
|
const bool __feat%foo@@P0%uses_stream = False;
|
|
const bool __feat%foo@@P0%uses_sync_advance = False;
|
|
const bool __feat%foo@@P0%is_filter = False;
|
|
const bool __feat%foo@@P0%supports_filters = False;
|
|
const bool __feat%foo@@P0%supports_sinks = False;
|
|
const bool __feat%foo@@P0%synchronization = False;
|
|
const bool __feat%foo@@P1%uses_offset = False;
|
|
const bool __feat%foo@@P1%uses_random_access = False;
|
|
const bool __feat%foo@@P1%uses_stream = False;
|
|
const bool __feat%foo@@P1%uses_sync_advance = False;
|
|
const bool __feat%foo@@P1%is_filter = False;
|
|
const bool __feat%foo@@P1%supports_filters = False;
|
|
const bool __feat%foo@@P1%supports_sinks = False;
|
|
const bool __feat%foo@@P1%synchronization = False;
|
|
const bool __feat%foo@@P2%uses_offset = False;
|
|
const bool __feat%foo@@P2%uses_random_access = False;
|
|
const bool __feat%foo@@P2%uses_stream = False;
|
|
const bool __feat%foo@@P2%uses_sync_advance = False;
|
|
const bool __feat%foo@@P2%is_filter = False;
|
|
const bool __feat%foo@@P2%supports_filters = False;
|
|
const bool __feat%foo@@P2%supports_sinks = False;
|
|
const bool __feat%foo@@P2%synchronization = False;
|
|
|
|
init function void __register_foo_P0() {
|
|
}
|
|
|
|
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>;
|
|
{
|
|
hilti::debugIndent("spicy");
|
|
local iterator<stream> __begin = begin(__cur);
|
|
local strong_ref<stream> filtered = Null;
|
|
|
|
if ( ! filtered )
|
|
__result = (*self).__parse_foo__P1_stage2(__data, __begin, __cur, __trim, __lah, __lahe, __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>;
|
|
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 ( __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 ( __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 ( __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 {
|
|
hilti::debugIndent("spicy");
|
|
local iterator<stream> __begin = begin(__cur);
|
|
local strong_ref<stream> filtered = Null;
|
|
|
|
if ( ! filtered )
|
|
__result = (*self).__parse_foo__P2_stage2(__data, __begin, __cur, __trim, __lah, __lahe, __error);
|
|
|
|
}
|
|
catch ( hilti::SystemException __except ) {
|
|
(*self).__on_0x25_error(hilti::exception_what(__except));
|
|
throw;
|
|
}
|
|
|
|
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>;
|
|
{
|
|
# "<...>/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", Null);
|
|
((*self).x, __cur) = (*unpack<uint<8>>((__cur, hilti::ByteOrder::Network)));
|
|
|
|
if ( __trim )
|
|
(*__data).trim(begin(__cur));
|
|
|
|
# End parsing production: Variable: x -> uint<8>
|
|
}
|
|
|
|
{
|
|
# "<...>/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", 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;
|
|
(*self).__on_y((*self).y);
|
|
__error = (*self).__error;
|
|
}
|
|
|
|
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 ( __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 ( __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 ( __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);
|
|
}
|
|
|
|
}
|