From d09c5227b2fb8ab2747e3e57ad90c5f0976211f9 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sat, 6 Mar 2021 00:47:29 +0530 Subject: Delete command parsing functions. We will not auto-parse commands and try to associate a binding to inputs. If we specify the command using the arguments field of the CWL specification, we don't need to know the base command or the bindings. * ccwl/ccwl.scm: Do not import (srfi srfi-71). (parse-arguments, break-pair, parse-command): Delete functions. --- ccwl/ccwl.scm | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) diff --git a/ccwl/ccwl.scm b/ccwl/ccwl.scm index 5a1f5b5..1d44dfc 100644 --- a/ccwl/ccwl.scm +++ b/ccwl/ccwl.scm @@ -7,7 +7,6 @@ #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) #:use-module (srfi srfi-9 gnu) - #:use-module (srfi srfi-71) #:use-module (ice-9 match) #:export (clitool workflow @@ -65,53 +64,6 @@ additional-inputs) (map output-id outputs))) -(define* (parse-arguments args #:optional (position 1)) - "Parse ARGS, a list of command line arguments and return a parse -tree of labelled arguments. POSITION is an internal recursion -variable." - (match args - (((? string? head) tail ...) - (if (string-prefix? "-" head) - (match tail - ((tail-head tail ...) - (cons (list 'keyword head tail-head) - (parse-arguments tail position)))) - (error "Unrecognized argument" head))) - ((head tail ...) - (cons (list 'positional position head) - (parse-arguments tail (1+ position)))) - (() '()))) - -(define (break-pair pred lst) - "Return the longest initial prefix of LST that does not satisfy PRED, -and the remaining tail. PRED is a 2-arity predicate. For each element -under consideration, PRED is passed that element and the next. For the -last element of LST, PRED is passed that element alone." - (match lst - ((head next tail ...) - (if (not (pred head next)) - (let ((prefix tail (break-pair pred (cons next tail)))) - (values (cons head prefix) tail)) - (values (list) lst))) - ((last) - (if (not (pred last)) - (values lst (list)) - (values (list) lst))))) - -(define (parse-command args) - "Parse ARGS, a list of command line arguments and return two -lists---the base command and the actual arguments." - (let ((base-command arguments - (break-pair (case-lambda - ((arg next) - (and (string? arg) - (string-prefix? "-" arg) - (input? next))) - ((last-arg) - (input? last-arg))) - args))) - (values base-command - (parse-arguments arguments)))) (make-output id type binding source other)) -- cgit v1.2.3