about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorArun Isaac2026-06-25 14:26:08 +0100
committerArun Isaac2026-06-25 14:33:45 +0100
commit819d999b504f7a1f642c3b8c40b6be82bd7eda6d (patch)
treed8f81442ae59758cbf8507f0c517baff46709848 /scripts
parentc49dbef130f09667c619d1b7b77380aa53bae7e8 (diff)
downloadccwl-819d999b504f7a1f642c3b8c40b6be82bd7eda6d.tar.gz
ccwl-819d999b504f7a1f642c3b8c40b6be82bd7eda6d.tar.lz
ccwl-819d999b504f7a1f642c3b8c40b6be82bd7eda6d.zip
scripts: Move ccwl-read to its own module.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/ccwl45
1 files changed, 2 insertions, 43 deletions
diff --git a/scripts/ccwl b/scripts/ccwl
index bee3bef..6438e34 100755
--- a/scripts/ccwl
+++ b/scripts/ccwl
@@ -26,19 +26,17 @@ exec guile --no-auto-compile -e main -s "$0" "$@"
 
 ;;; Code:
 
-(use-modules (rnrs conditions)
-             (rnrs exceptions)
-             (srfi srfi-1)
+(use-modules (rnrs exceptions)
              (srfi srfi-26)
              (srfi srfi-28)
              (srfi srfi-37)
              (ice-9 match)
              (ice-9 exceptions)
-             (ice-9 textual-ports)
              (ccwl ccwl)
              (ccwl conditions)
              (ccwl cwl)
              (ccwl graphviz)
+             (ccwl lang)
              (ccwl ui)
              (ccwl utils))
 
@@ -69,45 +67,6 @@ exec guile --no-auto-compile -e main -s "$0" "$@"
                   (acons 'output-file arg result)))
         %help-option))
 
-(define* (ccwl-read #:optional (port (current-input-port)))
-  "Read an S-expression from @var{port}. This function wraps
-@code{read-syntax} to raise read errors the way ccwl likes to handle
-it."
-  (guard (c ((and (eq? (exception-kind c)
-                       'read-error)
-                  (message-condition? c)
-                  (irritants-condition? c))
-             ;; TODO: Once https://codeberg.org/guile/guile/issues/206
-             ;; is fixed, report error in source context using
-             ;; report-ccwl-violation.
-             (raise-exception
-              (apply formatted-message
-                     (condition-message c)
-                     (condition-irritants c)))))
-    (read-syntax port)))
-
-(define (syntax-list->vector x)
-  "Convert syntax @var{x} of a list into syntax of a vector."
-  (datum->syntax #f
-                 (syntax-case x ()
-                   ((elements ...)
-                    #'#(elements ...)))
-                 #:source x))
-
-(define (read-hash-vector chr port)
-  "Read vector from @var{port}. This function is intended for use with
-@code{read-hash-extend}."
-  (unget-char port chr)
-  (let ((lst (read-syntax port)))
-    (if (dotted-list? (syntax->datum lst))
-        (raise-exception
-         (condition (ccwl-violation lst)
-                    (formatted-message "Malformed vector: unexpected dotted list ~a"
-                                       (syntax->datum lst))))
-        (syntax-list->vector lst))))
-
-(read-hash-extend #\( read-hash-vector)
-
 (define %compile-error
   (make-parameter #f))