Parse month comments in period parsing, start work on streamlined period representation.

This commit is contained in:
Dominik Pantůček 2023-03-27 17:14:25 +02:00
parent 58f6391345
commit ae0c00da50
2 changed files with 22 additions and 2 deletions

View file

@ -130,7 +130,7 @@
(define (print-member-source mr)
(let* ((lines (dict-ref mr 'source mr))
(file-name (dict-ref mr 'file-name))
(hls (dict-ref mr 'highlights)))
(hls (dict-ref mr 'highlights '())))
(print file-name ":")
(print-source-listing
lines

View file

@ -47,6 +47,22 @@
testing
configuration)
;; Creates a new period value with optional since and before
;; comments.
(define (make-period since before . args)
(let ((scomment (if (not (null? args)) (car args) #f))
(bcomment (if (and (not (null? args))
(not (null? (cdr args))))
(cadr args)
#f)))
(list since before scomment bcomment)))
;; Simple accessors
(define period-since car)
(define period-before cadr)
(define period-scomment caddr)
(define period-bcomment cadddr)
;; Sorts period markers (be it start or end) chronologically and
;; returns the sorted list.
(define (sort-period-markers l)
@ -73,7 +89,11 @@
(month (cadr marker))
(line-number (if (null? (cddr marker))
#f
(caddr marker))))
(caddr marker)))
(comment (if (and line-number
(not (null? (cdddr marker))))
(cadddr marker)
#f)))
(if (eq? mtype rmt)
(if cb
(loop (cdr l)