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 @@ ...@@ -318,7 +318,7 @@
318 ((eof-object? current-token) 318 ((eof-object? current-token)
319 (syntax-error "Expected string-list but found " current-token)) 319 (syntax-error "Expected string-list but found " current-token))
320 ((eq? (car current-token) 'string) 320 ((eq? (car current-token) 'string)
321 (list (cdr current-token))) 321 (list 'string-list (cdr current-token)))
322 ((not (eq? (car current-token) 'delimiter)) 322 ((not (eq? (car current-token) 'delimiter))
323 (syntax-error "Expected string-list but found " (car current-token))) 323 (syntax-error "Expected string-list but found " (car current-token)))
324 ((char=? (cdr current-token) #\[) 324 ((char=? (cdr current-token) #\[)
...@@ -876,8 +876,13 @@ ...@@ -876,8 +876,13 @@
876 (define output #f) 876 (define output #f)
877 877
878 (define (sieve-usage) 878 (define (sieve-usage)
879 (display "usage: sieve.scm --file FILENAME [--output FILENAME]") 879 (display "usage: sieve.scm [OPTIONS]\n")
880 (newline) 880 (display "GNU sieve.scm -- compile a Sieve program into Scheme code\n")
881 (display "Options are:\n")
882 (display " -f, --file FILENAME Set input file name\n")
883 (display " -o, --output FILENAME Set output file name\n")
884 (display " -L, --lib-dir DIRNAME Set sieve library directory name\n")
885 (display " -d, --debug LEVEL Set debugging level\n")
881 (exit 0)) 886 (exit 0))
882 887
883 (define (sieve-expand-filename name) 888 (define (sieve-expand-filename name)
...@@ -907,6 +912,10 @@ ...@@ -907,6 +912,10 @@
907 (value #t)) 912 (value #t))
908 (output (single-char #\o) 913 (output (single-char #\o)
909 (value #t)) 914 (value #t))
915 (debug (single-char #\d)
916 (value #t))
917 (lib-dir (single-char #\L)
918 (value #t))
910 (help (single-char #\h)))) 919 (help (single-char #\h))))
911 920
912 (define program-name (car (command-line))) 921 (define program-name (car (command-line)))
...@@ -916,8 +925,12 @@ ...@@ -916,8 +925,12 @@
916 (cond 925 (cond
917 ((pair? x) 926 ((pair? x)
918 (case (car x) 927 (case (car x)
928 ((debug)
929 (set! sieve-debug (string->number (cdr x))))
919 ((file) 930 ((file)
920 (set! filename (cdr x))) 931 (set! filename (cdr x)))
932 ((lib-dir)
933 (set! sieve-libdir (cdr x)))
921 ((output) 934 ((output)
922 (set! output (cdr x))) 935 (set! output (cdr x)))
923 ((help) 936 ((help)
......