Clean up documentation

This commit is contained in:
puck 2024-10-04 01:21:07 +00:00
parent 55a1efa08f
commit 83d41ef778
16 changed files with 146 additions and 98 deletions

View file

@ -1,3 +1,4 @@
;; Parses `go.sum` files.
(define-library (zilch lang go sum)
(import
(scheme base) (scheme write) (scheme read) (scheme file) (scheme process-context) (scheme lazy) (scheme case-lambda)
@ -14,6 +15,7 @@
parse-go-sum-line parse-go-sum-file go-sum-line? go-sum-module go-sum-version go-sum-path go-sum-hash)
(begin
;; Contains the values from a single line from a `go.sum` file.
(define-record-type <go-sum-line>
(make-go-sum-line module version path hash)
go-sum-line?
@ -35,6 +37,7 @@
((char=? (string-ref str index) char) index)
(else (string-find str (+ index 1) char))))
;; Parses a `go.sum` line, and returns a `<go-sum-line>`.
(define (parse-go-sum-line line)
(define version-space-index (string-find line 0 #\space))
(unless version-space-index (error "go.sum line contains no space characters"))
@ -52,6 +55,7 @@
(set! version (string-copy version 0 path-index)))
(make-go-sum-line module-path version path (base64->bytevector (string-copy hash 3))))
;; Parses all the `go.sum` lines from `port`.
(define (parse-go-sum-file port)
(do ((parsed '())
(line "" (read-line port)))