<commit_before>
;; FIXME: Need to disable printing of structs with custom-write property

(module pretty-printer mzscheme
  (require (lib "list.ss")
           (lib "class.ss")
           (lib "pretty.ss")
           (lib "mred.ss" "mred")
           "pretty-helper.ss"
           "interfaces.ss"
           "params.ss"
           "prefs.ss")

  (provide pretty-print-syntax)

  ;; pretty-print-syntax : syntax port partition -> range%
  (define (pretty-print-syntax stx port primary-partition)
    (define range-builder (new range-builder%))
    (define-values (datum ht:flat=>stx ht:stx=>flat)
      (syntax->datum/tables stx primary-partition
                            (length (current-colors))
                            (current-suffix-option)))
    (define identifier-list
      (filter identifier? (hash-table-map ht:stx=>flat (lambda (k v) k))))
    (define (flat=>stx obj)
      (hash-table-get ht:flat=>stx obj))
    (define (stx=>flat stx)
      (hash-table-get ht:stx=>flat stx))
    (define (current-position)
      (let-values ([(line column position) (port-next-location port)])
        (sub1 position)))
    (define (pp-pre-hook obj port)
      (send range-builder set-start obj (current-position)))
    (define (pp-post-hook obj port)
      (let ([start (send range-builder get-start obj)]
            [end (current-position)]
            [stx (flat=>stx obj)])
        (when (and start stx)
          (send range-builder add-range stx (cons start end)))))
    (define (pp-extend-style-table identifier-list)
      (let* ([syms (map (lambda (x) (stx=>flat x)) identifier-list)]
             [like-syms (map syntax-e identifier-list)])
        (pretty-print-extend-style-table (pp-better-style-table)
                                         syms<commit_msg>fixed syntax browser bug (mailing list 10/10/2007)<commit_after>
;; FIXME: Need to disable printing of structs with custom-write property

(module pretty-printer mzscheme
  (require (lib "list.ss")
           (lib "class.ss")
           (lib "pretty.ss")
           (lib "mred.ss" "mred")
           "pretty-helper.ss"
           "interfaces.ss"
           "params.ss"
           "prefs.ss")

  (provide pretty-print-syntax)

  ;; pretty-print-syntax : syntax port partition -> range%
  (define (pretty-print-syntax stx port primary-partition)
    (define range-builder (new range-builder%))
    (define-values (datum ht:flat=>stx ht:stx=>flat)
      (syntax->datum/tables stx primary-partition
                            (length (current-colors))
                            (current-suffix-option)))
    (define identifier-list
      (filter identifier? (hash-table-map ht:stx=>flat (lambda (k v) k))))
    (define (flat=>stx obj)
      (hash-table-get ht:flat=>stx obj #f))
    (define (stx=>flat stx)
      (hash-table-get ht:stx=>flat stx))
    (define (current-position)
      (let-values ([(line column position) (port-next-location port)])
        (sub1 position)))
    (define (pp-pre-hook obj port)
      (send range-builder set-start obj (current-position)))
    (define (pp-post-hook obj port)
      (let ([start (send range-builder get-start obj)]
            [end (current-position)]
            [stx (flat=>stx obj)])
        (when (and start stx)
          (send range-builder add-range stx (cons start end)))))
    (define (pp-extend-style-table identifier-list)
      (let* ([syms (map (lambda (x) (stx=>flat x)) identifier-list)]
             [like-syms (map syntax-e identifier-list)])
        (pretty-print-extend-style-table (pp-better-style-table)
                                         syms
{'fraction_non_alphanumeric': 0.14106844741235391, 'fraction_numerical': 0.0027824151363383415, 'mean_word_length': 2.2504520795660037, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '527839', 'n_tokens_mistral': 1142, 'n_tokens_neox': 1104, 'n_words': 284}