<commit_before>=head1 TITLE

Data::Dumper::Default - The default output module of Data::Dumper.

=head1 VERSION

version 0.20

=head1 SYNOPSIS

TDB

=head1 DESCRIPTION

This module provides the default output style of C<Data::Dumper>.

=cut

.sub __library_data_dumper_default_onload :load
    find_type $I0, "Data::Dumper::Default"
    if $I0 > 1 goto END
    load_bytecode "library/Data/Dumper/Base.pir"
    load_bytecode "library/Data/Escape.pir"
    getclass $P0, "Data::Dumper::Base"
    subclass $P0, $P0, "Data::Dumper::Default"
END:
    .return ()
.end

.namespace ["Data::Dumper::Default"]

=head1 METHODS

A Data::Dumper::Default object has the following methods:

=over 4

=item style."dumpWithName"( shortname, name, dump )

=cut

.sub dumpWithName :method
    .param string shortname
    .param string name
    .param pmc dump
    .local int ret

    print "\""
    print shortname
    print "\" => "

    ret = self."dump"( name, dump )

    .return ( ret )
.end

=item style."dumpCached"( name, dump )

=cut

.sub dumpCached :method
    .param string name
    .param pmc dump

    print "\\"
    print name

    .return ( 1 )
.end


=item style."dumpProperties"( name, dump )

=cut

.sub dumpProperties :method
    .param string paramName
    .param pmc dump
    .local string name
    .local pmc prop
    .local int ret

    ret = 1
    if_null dump, END
    prophash prop, dump
    if_null prop, END

    print " with-properties: "
    clone name, paramName
    concat name, ".properties()"
    ret = self."dump"( name, prop )

END:
    .return ( ret )
.end

=item style.genericHash( name, hash )

Dumps a 'generic' Hash.

=cut

.sub genericHash :method
    .param string name
    .param pmc hash
    .local string indent
    .local string subindent
    .local pmc iter
    .local string key
    .local pmc val
    .local pmc keys
    .local string name2

    (subindent, indent) = self."newIndent"()

    $S0 = typeof hash
    print $S0

    print " {"

    new keys, .ResizablePMCArray
    new iter, .Iterator, hash
    set iter, 0

iter_loop:
    unless iter, iter_end

    shift key, iter
    push keys, key
    branch iter_loop

iter_end:
    keys."sort"()

dump_loop:
    unless keys, dump_end

    print "\n"
    print subindent

    shift key, keys

    new val, .ResizablePMCArray
    push val, name
    push val, key
    sprintf name2, "%s[\"%s\"]", val

    set val, hash[key]

    self."dumpWithName"( key, name2, val )

    unless keys, dump_end
    print ","

    branch dump_loop

dump_end:
    print "\n"
    print indent
    print "}"
    self."deleteIndent"()

    .return ( 1 )
.end

=item style."dumpStringEscaped"( string, escapeChar )

Escape any characters in a string so we can re-use it as a literal.

=cut

.sub dumpStringEscaped :method
    .param pmc var
    .param string char
    .local string str
    .local pmc escape

    escape = find_global "Data::Escape", "String"
    str = var
    str = escape( str, char )
    print str

    .return ( 1 )
.end

=item style."pmcDefault"( name, dump )

=cut

.sub pmcDefault :method
    .param string name
    .param pmc dump
    .local string type

    typeof type, dump
    print "PMC '"
    print type
    print "' "

    can $I0, dump, "__dump"
    if $I0 goto CAN_DUMP<commit_msg>Data::Dumper - use less cycles<commit_after>=head1 TITLE

Data::Dumper::Default - The default output module of Data::Dumper.

=head1 VERSION

version 0.20

=head1 SYNOPSIS

TDB

=head1 DESCRIPTION

This module provides the default output style of C<Data::Dumper>.

=cut

.sub __library_data_dumper_default_onload :load
    find_type $I0, "Data::Dumper::Default"
    if $I0 > 1 goto END
    load_bytecode "library/Data/Dumper/Base.pir"
    getclass $P0, "Data::Dumper::Base"
    subclass $P0, $P0, "Data::Dumper::Default"
END:
    .return ()
.end

.namespace ["Data::Dumper::Default"]

=head1 METHODS

A Data::Dumper::Default object has the following methods:

=over 4

=item style."dumpWithName"( shortname, name, dump )

=cut

.sub dumpWithName :method
    .param string shortname
    .param string name
    .param pmc dump
    .local int ret

    print "\""
    print shortname
    print "\" => "

    ret = self."dump"( name, dump )

    .return ( ret )
.end

=item style."dumpCached"( name, dump )

=cut

.sub dumpCached :method
    .param string name
    .param pmc dump

    print "\\"
    print name

    .return ( 1 )
.end


=item style."dumpProperties"( name, dump )

=cut

.sub dumpProperties :method
    .param string paramName
    .param pmc dump
    .local string name
    .local pmc prop
    .local int ret

    ret = 1
    if_null dump, END
    prophash prop, dump
    if_null prop, END

    print " with-properties: "
    clone name, paramName
    concat name, ".properties()"
    ret = self."dump"( name, prop )

END:
    .return ( ret )
.end

=item style.genericHash( name, hash )

Dumps a 'generic' Hash.

=cut

.sub genericHash :method
    .param string name
    .param pmc hash
    .local string indent
    .local string subindent
    .local pmc iter
    .local string key
    .local pmc val
    .local pmc keys
    .local string name2

    (subindent, indent) = self."newIndent"()

    $S0 = typeof hash
    print $S0

    print " {"

    new keys, .ResizablePMCArray
    new iter, .Iterator, hash
    set iter, 0

iter_loop:
    unless iter, iter_end

    shift key, iter
    push keys, key
    branch iter_loop

iter_end:
    keys."sort"()

dump_loop:
    unless keys, dump_end

    print "\n"
    print subindent

    shift key, keys

    new val, .ResizablePMCArray
    push val, name
    push val, key
    sprintf name2, "%s[\"%s\"]", val

    set val, hash[key]

    self."dumpWithName"( key, name2, val )

    unless keys, dump_end
    print ","

    branch dump_loop

dump_end:
    print "\n"
    print indent
    print "}"
    self."deleteIndent"()

    .return ( 1 )
.end

=item style."dumpStringEscaped"( string, escapeChar )

Escape any characters in a string so we can re-use it as a literal.

=cut

.sub dumpStringEscaped :method
    .param pmc var
    .param string char
    .local string str

    str = var
    str = escape  str
    print str

    .return ( 1 )
.end

=item style."pmcDefault"( name, dump )

=cut

.sub pmcDefault :method
    .param string name
    .param pmc dump
    .local string type

    typeof type, dump
    print "PMC '"
    print type
    print "' "

    can $I0, dump, "__dump"
    if $I0 goto CAN_DUMP
{'fraction_non_alphanumeric': 0.10467463891908682, 'fraction_numerical': 0.00838639540301289, 'mean_word_length': 2.5019032082653614, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7241041', 'n_tokens_mistral': 2285, 'n_tokens_neox': 2181, 'n_words': 730}