Commit 9c0caf82 9c0caf82fe4e87624c395060e9f6a607d4ebef34 by Sergey Poznyakoff

(sieve-parse-command): Bugfix: must always return a list whose car is

the token type.
New command line options: --debug and --lib-dir
1 parent bf2774af
......@@ -318,7 +318,7 @@
((eof-object? current-token)
(syntax-error "Expected string-list but found " current-token))
((eq? (car current-token) 'string)
(list (cdr current-token)))
(list 'string-list (cdr current-token)))
((not (eq? (car current-token) 'delimiter))
(syntax-error "Expected string-list but found " (car current-token)))
((char=? (cdr current-token) #\[)
......@@ -876,8 +876,13 @@
(define output #f)
(define (sieve-usage)
(display "usage: sieve.scm --file FILENAME [--output FILENAME]")
(newline)
(display "usage: sieve.scm [OPTIONS]\n")
(display "GNU sieve.scm -- compile a Sieve program into Scheme code\n")
(display "Options are:\n")
(display " -f, --file FILENAME Set input file name\n")
(display " -o, --output FILENAME Set output file name\n")
(display " -L, --lib-dir DIRNAME Set sieve library directory name\n")
(display " -d, --debug LEVEL Set debugging level\n")
(exit 0))
(define (sieve-expand-filename name)
......@@ -907,6 +912,10 @@
(value #t))
(output (single-char #\o)
(value #t))
(debug (single-char #\d)
(value #t))
(lib-dir (single-char #\L)
(value #t))
(help (single-char #\h))))
(define program-name (car (command-line)))
......@@ -916,8 +925,12 @@
(cond
((pair? x)
(case (car x)
((debug)
(set! sieve-debug (string->number (cdr x))))
((file)
(set! filename (cdr x)))
((lib-dir)
(set! sieve-libdir (cdr x)))
((output)
(set! output (cdr x)))
((help)
......