From 95300bf9c4cee568fe9e51cae842a52098efe37f Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sun, 16 Jan 2022 01:32:46 +0530 Subject: scripts: Report ccwl syntax violations. * ccwl/ui.scm: New file. * scripts/ccwl: Import (rnrs exceptions), (srfi srfi-28), (ccwl conditions) and (ccwl ui). (main): Handle ccwl syntax violations by reporting them and exiting. --- scripts/ccwl | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/ccwl b/scripts/ccwl index 63a929a..1215486 100755 --- a/scripts/ccwl +++ b/scripts/ccwl @@ -24,12 +24,15 @@ ;;; Code: -(use-modules (srfi srfi-28) +(use-modules (rnrs exceptions) + (srfi srfi-28) (srfi srfi-37) (ice-9 match) (ccwl ccwl) + (ccwl conditions) (ccwl cwl) - (ccwl graphviz)) + (ccwl graphviz) + (ccwl ui)) (define (invalid-option opt name arg result) (error "Invalid option" name)) @@ -84,8 +87,14 @@ Compile SOURCE-FILE. ((cond ((string=? to "cwl") workflow->cwl) ((string=? to "dot") workflow->dot)) - (load (canonicalize-path (assq-ref args 'source-file)) - read-syntax) + (guard (exception + ;; Handle syntax violation exceptions by reporting + ;; them and exiting. + ((ccwl-violation? exception) + (report-ccwl-violation exception) + (exit #f))) + (load (canonicalize-path (assq-ref args 'source-file)) + read-syntax)) (current-output-port))))) ((program args ...) (let ((args (args-fold args -- cgit v1.2.3