<commit_before>! Copyright (C) 2003, 2010 <NAME>.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays classes colors.constants combinators
continuations generic grouping io io.streams.string io.styles
kernel make math math.parser namespaces prettyprint.config
prettyprint.custom prettyprint.sections sequences strings
vocabs.prettyprint words ;
IN: prettyprint

: with-use ( obj quot -- )
    t make-pprint (pprint-manifest
    [ pprint-manifest) ] [ [ drop nl ] unless-empty ] bi
    do-pprint ; inline

: with-in ( obj quot -- )
    t make-pprint current-vocab>> [ pprint-in bl ] when* do-pprint ; inline

: pprint ( obj -- ) [ pprint* ] with-pprint ;

: . ( obj -- ) pprint nl ;

: ... ( obj -- ) [ . ] without-limits ;

: pprint-use ( obj -- ) [ pprint* ] with-use ;

: unparse ( obj -- str ) [ pprint ] with-string-writer ;

: unparse-use ( obj -- str ) [ pprint-use ] with-string-writer ;

: pprint-short ( obj -- )
    [ pprint ] with-short-limits ;

: unparse-short ( obj -- str )
    [ pprint-short ] with-string-writer ;

: short. ( obj -- ) pprint-short nl ;

: error-in-pprint ( obj -- str )
    class-of name>> "~pprint error: " "~" surround ;

: .b ( n -- ) >bin "0b" prepend print ;
: .o ( n -- ) >oct "0o" prepend print ;
: .h ( n -- ) >hex "0x" prepend print ;

: stack. ( seq -- )
    [
        [ short. ] [
            drop [ error-in-pprint ] keep write-object nl
        ] recover
    ] each ;

: .s ( -- ) get-datastack stack. ;
: .r ( -- ) get-retainstack stack. ;

<PRIVATE

SYMBOL: =>

\ =>
{ { foreground COLOR: white } { background COLOR: black } }
"word-style" set-word-prop

: remove-step-into ( word -- )<commit_msg>prettyprint: fix .b, .o, and .h for negative numbers.<commit_after>! Copyright (C) 2003, 2010 <NAME>.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays classes colors.constants combinators
continuations generic grouping io io.streams.string io.styles
kernel make math math.parser namespaces prettyprint.config
prettyprint.custom prettyprint.sections sequences strings
vocabs.prettyprint words ;
IN: prettyprint

: with-use ( obj quot -- )
    t make-pprint (pprint-manifest
    [ pprint-manifest) ] [ [ drop nl ] unless-empty ] bi
    do-pprint ; inline

: with-in ( obj quot -- )
    t make-pprint current-vocab>> [ pprint-in bl ] when* do-pprint ; inline

: pprint ( obj -- ) [ pprint* ] with-pprint ;

: . ( obj -- ) pprint nl ;

: ... ( obj -- ) [ . ] without-limits ;

: pprint-use ( obj -- ) [ pprint* ] with-use ;

: unparse ( obj -- str ) [ pprint ] with-string-writer ;

: unparse-use ( obj -- str ) [ pprint-use ] with-string-writer ;

: pprint-short ( obj -- )
    [ pprint ] with-short-limits ;

: unparse-short ( obj -- str )
    [ pprint-short ] with-string-writer ;

: short. ( obj -- ) pprint-short nl ;

: error-in-pprint ( obj -- str )
    class-of name>> "~pprint error: " "~" surround ;

: .b ( n -- ) 2 number-base [ . ] with-variable ;
: .o ( n -- ) 8 number-base [ . ] with-variable ;
: .h ( n -- ) 16 number-base [ . ] with-variable ;

: stack. ( seq -- )
    [
        [ short. ] [
            drop [ error-in-pprint ] keep write-object nl
        ] recover
    ] each ;

: .s ( -- ) get-datastack stack. ;
: .r ( -- ) get-retainstack stack. ;

<PRIVATE

SYMBOL: =>

\ =>
{ { foreground COLOR: white } { background COLOR: black } }
"word-style" set-word-prop

: remove-step-into ( word -- )
{'fraction_non_alphanumeric': 0.1628178895059924, 'fraction_numerical': 0.006723180356620871, 'mean_word_length': 2.428857715430862, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 20, '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': '7231584', 'n_tokens_mistral': 1236, 'n_tokens_neox': 1208, 'n_words': 307}