<commit_before>#lang scribble/manual
@(require scribble/eval
          (for-label drracket/check-syntax
                     racket))
@(define syncheck-example-eval (make-base-eval))
@(begin 
   (syncheck-example-eval
    '(require drracket/check-syntax racket/class)))
               

@title{DrRacket Tools}
@author{<NAME>}

This manual describes portions of DrRacket's functionality
that are exposed via Racket APIs to be used with other editors.

@table-of-contents[]

@section{Accessing Check Syntax Programmatically}

@defmodule[drracket/check-syntax]

@defproc[(show-content [file-or-stx (or/c path-string?
                                          (and/c syntax?
                                                 (λ (x) (path-string? (syntax-source x)))))])
         (listof vector?)]{

This procedure composes the other pieces of this library together in a way that can be used
for REPL-style experimentation with the results from Check Syntax, as shown in the example
below. The list it returns has one vector for each call that would be made to the
object in @racket[current-annotations]. Each vector's first element is a symbol naming
a method in @racket[syncheck-annotations<%>] and the other elements of the vector are
the arguments passed to the method.

This doesn't work as well for use in a real tool, however, because it doesn't account for
the callback procedures present in @method[syncheck-annotations<%> syncheck:add-arrow/name-dup]
and @method[syncheck-annotations<%> syncheck:add-id-set] and the resulting vectors are probably less
convenient to work with than direct method calls for most uses of this library. Nevertheless,
it gives a quick feel for the results that can come back from Check Syntax.

See @racket[annotations-mixin] for some example code to use the other parts of this library.

  @interaction[#:eval
               syncheck-example-eval
               (let ([example-module
                      '(module m racket (λ (x) x))])
                 (show-content 
                  (read-syntax
                   (build-path (current-directory) "dummy-file.rkt")
                   (open-input-string (format "~s" example-module)))))]
}

@defproc[(make-traversal [namespace namespace?]<commit_msg>adjust docs for drracket/check-syntax so the example doesn't include paths directly into the plt tree<commit_after>#lang scribble/manual
@(require scribble/eval
          (for-label drracket/check-syntax
                     racket))
@(define syncheck-example-eval (make-base-eval))
@(begin 
   (syncheck-example-eval
    '(require drracket/check-syntax racket/class setup/collects)))
               

@title{DrRacket Tools}
@author{<NAME>}

This manual describes portions of DrRacket's functionality
that are exposed via Racket APIs to be used with other editors.

@table-of-contents[]

@section{Accessing Check Syntax Programmatically}

@defmodule[drracket/check-syntax]

@defproc[(show-content [file-or-stx (or/c path-string?
                                          (and/c syntax?
                                                 (λ (x) (path-string? (syntax-source x)))))])
         (listof vector?)]{

This procedure composes the other pieces of this library together in a way that can be used
for REPL-style experimentation with the results from Check Syntax, as shown in the example
below. The list it returns has one vector for each call that would be made to the
object in @racket[current-annotations]. Each vector's first element is a symbol naming
a method in @racket[syncheck-annotations<%>] and the other elements of the vector are
the arguments passed to the method.

This doesn't work as well for use in a real tool, however, because it doesn't account for
the callback procedures present in @method[syncheck-annotations<%> syncheck:add-arrow/name-dup]
and @method[syncheck-annotations<%> syncheck:add-id-set] and the resulting vectors are probably less
convenient to work with than direct method calls for most uses of this library. Nevertheless,
it gives a quick feel for the results that can come back from Check Syntax.

See @racket[annotations-mixin] for some example code to use the other parts of this library.

Note that the paths in the example below have been replaced via @racket[make-paths-be-module-paths]
in order to make the results be platform independent.

  @interaction[#:eval
               syncheck-example-eval
               
               (define (make-paths-be-module-paths x)
                 (let loop ([x x])
                   (cond
                     [(pair? x) (cons (loop (car x)) (loop (cdr x)))]
                     [(vector? x) (for/vector ([x (in-vector x)])
                                    (loop x))]
                     [(path? x) (path->module-path x)]
                     [else x])))
               
               (let ([example-module
                      '(module m racket (λ (x) x))])
                 (make-paths-be-module-paths
                  (show-content 
                   (read-syntax
                    (build-path (current-directory) "dummy-file.rkt")
                    (open-input-string (format "~s" example-module))))))]
}

@defproc[(make-traversal [namespace namespace?]
{'fraction_non_alphanumeric': 0.09120646526842409, 'fraction_numerical': 0.0, 'mean_word_length': 2.5050573162508427, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 9, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '263032', 'n_tokens_mistral': 1434, 'n_tokens_neox': 1339, 'n_words': 534}