Period errors reporting.

This commit is contained in:
Dominik Pantůček 2023-03-20 14:55:37 +01:00
parent 0d127e7200
commit 3c4ebedbb3
2 changed files with 32 additions and 15 deletions

View file

@ -181,10 +181,19 @@
;; list to periods. ;; list to periods.
(define (convert-member-key:markers->periods m k) (define (convert-member-key:markers->periods m k)
(if (dict-has-key? m k) (if (dict-has-key? m k)
(dict-set m k (let* ((res (period-markers->periods
(period-markers->periods (sort-period-markers
(sort-period-markers (dict-ref m k '()))))
(dict-ref m k '())))) (ok? (car res))
(periods (cadr res))
(msg (caddr res))
(line-number (cadddr res))
(m1 (dict-set m k periods)))
(if ok?
m1
(dict-set m1 member-file-error-symbol
(cons (list line-number msg)
(dict-ref m1 member-file-error-symbol '())))))
m)) m))
;; Converts all given keys using period-markers->periods. ;; Converts all given keys using period-markers->periods.

View file

@ -65,23 +65,31 @@
(ps '()) (ps '())
(cb #f)) (cb #f))
(if (null? l) (if (null? l)
(if cb (list #t
(reverse (cons (cons cb #f) ps)) (if cb
(reverse ps)) (reverse (cons (cons cb #f) ps))
(let ((m (car l)) (reverse ps))
(rmt (if cb 'stop 'start))) ""
(if (eq? (car m) rmt) -1)
(let* ((marker (car l))
(rmt (if cb 'stop 'start))
(mtype (car marker))
(month (cadr marker))
(line-number (caddr marker)))
(if (eq? mtype rmt)
(if cb (if cb
(loop (cdr l) (loop (cdr l)
(cons (cons cb (cadr m)) ps) (cons (cons cb month) ps)
#f) #f)
(loop (cdr l) (loop (cdr l)
ps ps
(cadr m))) month))
(if (eq? (*member-file-check-syntax*) 'error) (if (eq? (*member-file-check-syntax*) 'error)
(error 'period-markers->periods "Invalid start/stop sequence marker" m) (error 'period-markers->periods "Invalid start/stop sequence marker" marker)
(reverse ps) ; Just ignore it for now (list #f
)))))) (reverse ps)
(sprintf "Invalid start/stop sequence marker ~A" marker)
line-number)))))))
;; Returns duration of period in months. Start is included, end is ;; Returns duration of period in months. Start is included, end is
;; not. The period contains the month just before the specified end. ;; not. The period contains the month just before the specified end.