## symbol-and-picklehash-unpickling.pkg
# Compiled by:
#
src/lib/compiler/core.sublibstipulate
package ph = picklehash; # picklehash is from
src/lib/compiler/front/basics/map/picklehash.pkg package sy = symbol; # symbol is from
src/lib/compiler/front/basics/map/symbol.pkg package upr = unpickler; # unpickler is from
src/lib/compiler/src/library/unpickler.pkgherein
package symbol_and_picklehash_unpickling
: Symbol_And_Picklehash_Unpickling # Symbol_And_Picklehash_Unpickling is from
src/lib/compiler/front/semantic/pickle/symbol-and-picklehash-unpickling.api {
fun read_symbol (unpickler, read_string)
=
{ m = upr::make_sharemap ();
fun s ()
=
{ fun symbol con = con (read_string ());
fun rs 'a' => symbol sy::make_value_symbol;
rs 'b' => symbol sy::make_type_symbol;
rs 'c' => symbol sy::make_api_symbol;
rs 'd' => symbol sy::make_package_symbol;
rs 'e' => symbol sy::make_generic_symbol;
rs 'f' => symbol sy::make_generic_api_symbol;
rs 'g' => symbol sy::make_fixity_symbol;
rs 'h' => symbol sy::make_label_symbol;
rs 'i' => symbol sy::make_typevar_symbol;
rs _ => raise exception upr::FORMAT;
end;
upr::read_sharable_value unpickler m rs;
};
s;
};
fun read_picklehash (unpickler, read_string)
=
read_picklehash'
where
picklehash_sharemap = upr::make_sharemap ();
fun read_picklehash' ()
=
upr::read_sharable_value unpickler picklehash_sharemap read_picklehash''
where
fun read_picklehash'' 'p'
=>
ph::from_bytes (byte::string_to_bytes (read_string ()));
read_picklehash'' _
=>
raise exception upr::FORMAT;
end;
end;
end;
};
end;