better error reporting
This commit is contained in:
@@ -124,7 +124,8 @@
|
||||
(lines (if (file-exists? file) (file->lines file) '()))
|
||||
(re-section #px"^\\[([a-zA-Z0-9_.-]+)\\]$")
|
||||
(re-keyval #px"^([a-zA-Z0-9_.-]+)[=](.*)$")
|
||||
(re-comment #px"^[;](.*)$"))
|
||||
(re-comment #px"^[;](.*)$")
|
||||
(line-nr 0))
|
||||
(letrec ((f (lambda (sections section lines)
|
||||
(if (null? lines)
|
||||
(append sections (list section))
|
||||
@@ -133,6 +134,7 @@
|
||||
(m-comment (regexp-match re-comment line))
|
||||
(m-keyval (regexp-match re-keyval line))
|
||||
(m-section (regexp-match re-section line)))
|
||||
(set! line-nr (+ 1 line-nr))
|
||||
(if empty
|
||||
(f sections (append section (list (list 'empty))) (cdr lines))
|
||||
(if m-comment
|
||||
@@ -146,7 +148,7 @@
|
||||
(interpret (string-trim (caddr m-keyval)))))) (cdr lines))
|
||||
(if m-section
|
||||
(f (append sections (list section)) (list (string->symbol (string-trim (cadr m-section)))) (cdr lines))
|
||||
(error "Unknown INI line"))))))))))
|
||||
(error (format "Unknown INI line\n~a: ~a\n" line-nr line)))))))))))
|
||||
(mcons 'ini (f '() (list 'nil) lines)))))
|
||||
|
||||
(define (ini-get ini section key def-val)
|
||||
|
||||
Reference in New Issue
Block a user