Skip to content

Commit

Permalink
Remove more dead syntax formatting code
Browse files Browse the repository at this point in the history
  • Loading branch information
jackfirth committed Aug 28, 2024
1 parent c520e3d commit 9d7cfb8
Showing 1 changed file with 0 additions and 55 deletions.
55 changes: 0 additions & 55 deletions private/syntax-replacement.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -65,45 +65,6 @@
(original-syntax new-syntax introduction-scope))


(define (template-separator? stx)
(syntax-parse stx
#:literals (ORIGINAL-GAP)
[(ORIGINAL-GAP _ ...) #true]
[else #false]))


(define/guard (add-contents-between lst adder)
(guard-match (cons first-element remaining-elements) lst #:else '())
(cons
first-element
(for/list ([previous (in-list lst)]
[element (in-list remaining-elements)]
#:when #true
[inserted (append (adder previous element) (list element))])
inserted)))


(module+ test
(test-case (name-string add-contents-between)

(define (appended-strings left right)
(list (format "left: ~a" left) (format "right: ~a" right)))

(test-case "empty list"
(check-equal? (add-contents-between '() appended-strings) '()))

(test-case "singleton list"
(check-equal? (add-contents-between (list 1) appended-strings) (list 1)))

(test-case "two-element list"
(define actual (add-contents-between (list 1 2) appended-strings))
(check-equal? actual (list 1 "left: 1" "right: 2" 2)))

(test-case "many-element list"
(define actual (add-contents-between (list 1 2 3) appended-strings))
(check-equal? actual (list 1 "left: 1" "right: 2" 2 "left: 2" "right: 3" 3)))))


(define (syntax-replacement-render replacement)

(define/guard (pieces stx)
Expand Down Expand Up @@ -173,22 +134,6 @@
#:start start #:end (+ start (syntax-span orig-stx)) #:contents (pieces new-stx)))


(define/guard (ends-with-newline? piece-list)
(guard (not (empty? piece-list)) #:else #true)
(define last-piece (last piece-list))
(guard (inserted-string? last-piece) #:else #false)
(define str (inserted-string-contents last-piece))
(equal? (string-ref str (sub1 (string-length str))) #\newline))


(define/guard (starts-with-newline? piece-list)
(guard (not (empty? piece-list)) #:else #true)
(define first-piece (first piece-list))
(guard (inserted-string? first-piece) #:else #false)
(define str (inserted-string-contents first-piece))
(equal? (string-ref str 0) #\newline))


(define/guard (join-piece-lists piece-lists)
(guard (not (empty? piece-lists)) #:else '())
(apply append (add-between piece-lists (list (inserted-string " ")))))
Expand Down

0 comments on commit 9d7cfb8

Please sign in to comment.